Showing posts with label To Remove The Problems of Function Overloading. Show all posts
Showing posts with label To Remove The Problems of Function Overloading. Show all posts

Friday, 27 April 2012

Program To Remove The Problems of Function Overloading



#include<iostream.h>
#include<conio.h>
template<class T>
class add
{
private:
T a;
public:
       void getdatab(T x)
{
 a=x;
}
void displayb()
{
cout<<"a="<<a;
}
};
template<class T>
{
private:
T b;
public:
       void getdatad(T y)
{
 b=y;
}
void displayd()
{
cout<<"\n b="<<b;
}
};
void main()
{
sub <int> a1;
clrscr();
a1.getdatab(4);
a1.displayb();
a1.getdatad(6);
a1.displayd();
getch();
}