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

Popular posts from this blog

To configure the IP address for a computer connected to LAN

Write a menu driven program to perform insertion and deletion operations in a single linked list