Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
391 B
1
Indexable
#include<iostream>
using namespace std;
class num
{
private:
int x,y;
public:
num(int a,int b)
{
x=a;
y=b;
}
void show()
{
cout<<"\n x="<<x<<"\n y="<<y<<endl;
}
void operator=(num e)
{
x=e.x;
y=e.y;
}
};
int main()
{
num a(20,30),b(40,60);
cout<<"\n before assignment:";
a.show();
b.show();
a.operator=(b);
cout<<"\n after assingment:";
a.show ();
b.show();
}