#include<iostream.h>
#include<conio.h>
class assign
{
private:
                int a,b;
public:
                assign(int p,int q)
                                {
                                a=p;
                                b=q;
                                }
                void display()
                                {
                                cout<<"A = "<<a<<"\tB = "<<b<<endl;
                                }
};
void main()
{
                clrscr();
                assign x(5,3),y(2,4);
                x.display();
                y.display();
                y=x;       //Implicit Operator Overloading
                cout<<"After Operator Overloading \n";
                x.display();
                y.display();
                getch();
}

183.PNG

Advertisements