//scope resolution
//terniry operator
//dot operator
//pointer
//conditional these five operator can,t be overloaded.
//other operator
//ask for more....
#include<iostream>
using namespace std;
class abc
{
int a;
public:
void set(int x)
{
a=x;
}
abc operator+(abc c)
{
abc temp;
temp.a=a+c.a;
}
void show()
{
cout<<"A:"<<a;
}
};
main()
{
abc a,b,c;
a.set(5);
b.set(3);
//c=a+b
c=a+b;
c.show();
}
//terniry operator
//dot operator
//pointer
//conditional these five operator can,t be overloaded.
//other operator
//ask for more....
#include<iostream>
using namespace std;
class abc
{
int a;
public:
void set(int x)
{
a=x;
}
abc operator+(abc c)
{
abc temp;
temp.a=a+c.a;
}
void show()
{
cout<<"A:"<<a;
}
};
main()
{
abc a,b,c;
a.set(5);
b.set(3);
//c=a+b
c=a+b;
c.show();
}
No comments:
Post a Comment