can anyone give me a good example of implementing the 'this' pointer in functions and methods for classes?
if the answer is yes, cheers! http://www.cprogramming.com/cboard/i...ons/icon14.gif
can anyone give me a good example of implementing the 'this' pointer in functions and methods for classes?
if the answer is yes, cheers! http://www.cprogramming.com/cboard/i...ons/icon14.gif
Overloaded assignment operator -
const SomeClass& operator=(const SomeClass& rhs)
{
//Check for self assignment
if(&rhs==this)
return;
else
//Copy stuff
//return so chaining is possible
return *this
}
zen