#include<iostream.h>
#include<conio.h>
class test
{
private:
int a,b;
public:
void getdata(int x,int y)
{
a=x;
b=y;
}
test operator +(test t)
{
test te;
te.a= a + t.a;
te.b= b + t.b;
return te;
}
void display()
{
int c;
cout<<a<<" + "<<b <<" i";
}
} ;
main()
{
clrscr();
test t1,t2,t3;
t1.getdata(4,5);
t2.getdata(2,7);
t3 = t1 + t2;
t3.display();
getch();
}
No comments:
Post a Comment