#include<iostream.h>
template<class T>
class Add
{
private:
T a,b,c,res;
public:
void getdata()
{
cout<<"\n Enter the ist value = ";
cin>>a;
cout<<"\n Enter the second value = ";
cin>>b;
cout<<"\n Enter the Third value = ";
cin>>c;
}
void display()
{
res = (a+b+c);
cout<<"\n\n Sum is = "<<res<<endl;
}
};
void main()
{
Add<int>s;
s.getdata();
s.display();
Add<float>s1;
s1.getdata();
s1.display();
}
template<class T>
class Add
{
private:
T a,b,c,res;
public:
void getdata()
{
cout<<"\n Enter the ist value = ";
cin>>a;
cout<<"\n Enter the second value = ";
cin>>b;
cout<<"\n Enter the Third value = ";
cin>>c;
}
void display()
{
res = (a+b+c);
cout<<"\n\n Sum is = "<<res<<endl;
}
};
void main()
{
Add<int>s;
s.getdata();
s.display();
Add<float>s1;
s1.getdata();
s1.display();
}