source file name: optor2.cpp

 #include<stdio.h>

#include<conio.h>

#include<iostream.h>

class Beta

{

int x,y,z;

public:

void getdata(int a, int b,int c)

{

x=a;

y=b;

z=c;

}

void show()

{

cout<<" x: "<<x <<" y: "<<y <<" z: "<<z<<endl;

}

void operator+()

{

x=x+x;

y=y+y;

z=z+z;


}

};


void main()

{


clrscr();

cout<<"Operator overloading program: ";

Beta B;

B.getdata(10,20,30);

cout<< "\n B= ";

B.show();

+B;

cout<<"\n after applying operator (+)function  values are double ";

cout<< "\n B= ";

B.show();

getch();

}

Output:

Operator overloading program:

B= 10 20 30

 after applying operator function(+)  values are double

B= 20 40 60