#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class add
{
private: int a,b;
public:
add()
{
a=b=0;
}
void input()
{
cout<<"enter value of a";
cin>>a;
cout<<"enter value of b";
cin>>b;
}
void show()
{
cout<<"value ofa"<<a;
cout<<"value of b"<<b;
}
add operator +(add p)
{
add temp;
temp.a=p.a+a;
temp.b=p.b+b;
return temp;
}
};
void main()
{
add x,y,z;
x.input();
y.input();
x.show();
y.show();
z=x+y;
z.show();
getch();
}
0 comments:
Post a Comment