Operator Overload = Not Working
Again Problem With teh Same Point Class
Code Pasted Here http://phpfi.com/246031
BEFORE I used
Code:
pt2 = pt1;//Works fine
But I noticed that
Its not calling the overloaded 'Operator='
So I made it
On line 44 But Although Its Calling the Overloaded 'Operator='
{As its printing "I am Getting Executed" on the line}
This is the 'Operator=' function
Code:
Point* Point::operator=(const Point& pt){
cout<<"I am Getting Executed"<<endl;
return this;//datatype Of this is Point* Const
}
On line 20-22
Please help.
--------------------------------------------------------------------
here is the Output of this Programm
--------------------------------------------------------------------
Code:
Describing Class : pt1 x = 15 y = 10
Describing Class : pt2 before Copying x = 4 y = 8
I am Getting Executed
Describing Class : pt2 after Copying x = 4 y = 8
destructing
Describing Class : pt2 after Increamenting x = 9 y = 13
destructing
Describing Class : pt1 after Decrementing x = 6 y = -3