source file name: opequal,CPP

#include<iostream.h>

#include<conio.h>

class Circle

{

int r;

public:

Circle(){}

Circle(int n)

{

r=n;

}

void disp()

{

cout<<"\n radius= "<<r <<endl;

}

Circle operator=(int);

};

Circle Circle::operator=(int n)

{

r=n;

return *this;

}

int main()

{

Circle c1(10),c2,c3;


clrscr();

 cout<<"\n  Object c1";c1.disp();

 c2=c1;// automatic overlaoding

 cout<<"\n Object c2:";

 c2.disp();

 c1=c3=30;    // overloading =30

 cout<< "\n object C1 and C3 values :";

 c1.disp();

 c3.disp();

getch();

return 0;

}

output: