DFS :: OPERATOR

#include<iostream.h>
#include<conio.h>
class add
{
int a,b,c,d;
public:
getdata();
operator ++();
friend operator +(add obj,add ob);

};
add :: getdata()
{
cout<< “Enter the first value:- “;
cin>> a;
cout<<“Enter the second value:- “;
cin >> b;
}
add :: operator ++()
{
c= ++a + ++b;
}
operator +(add obj, add ob)
{ int c,d;
c=obj.a+ob.a;
d=obj.b+ob.b;
cout<<c<<“\n”<<d;
}
void main()
{
clrscr();
add ob,obj;
ob.getdata();
obj.getdata();
/* ++ob; */
obj+ ob;
getch();
}

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.