Program to illustrate the concept of templates.
#include<iostream> using namespace std; template <class t> void display(t x) { cout<<"Displaying function of template : "<<x<<endl; } void display(int x) { cout<<"Explicit Display function : "<<x<<endl; } int main() { display(200); display(12.05); display('a'); cout<<"\n/*\nName-Sanjampreet Singh\nRoll Number-1507967\n*/"; } Output:

Comments
Post a Comment