CSE EXAM-20 OOP PART B 5(a)
BY UJJAL ROY
#include<bits/stdc++.h>
using namespace std;
class op
{
int a;
public :
op(){a=0;}
op(int z)
{
a=z;
}
void show()
{
cout<<a<<endl;
}
op operator+(op o)
{
op temp;
temp.a=a+o.a;
return temp;
}
};
int main()
{
op om1(19),om2(20),om3;
om1.show();
om2.show();
om3=om1+om2;
om3.show();
om3=om1;
om3.show();
return 0;
}
0 Comments