using namespace std;
class number
{
int n1,n2;
public: number(int x=0,int y=0)
{
n1=x;
n2=y;
}
void show()
{
cout n1 & n2
}
number operator +(number);
};
number number:: operator +(number n)
{
number t;
t.n1=n1+n.n1;
t.n2=n2+n.n2;
return t;
}
int main()
{
number a(2,3),b(5,6),c;
a.show();
b.show();
c=a+b;
c.show();
system("pause");
}
No comments:
Post a Comment