is there some special way to copy class object to another object of the same class? or am i forced to do operator overloading for that one?
is there some special way to copy class object to another object of the same class? or am i forced to do operator overloading for that one?
Last edited by ExDHaos; 05-23-2009 at 02:45 AM.
Either the compiler-generated assignment operator and copy constructor do the right thing (simple memberwise copy/assignment) or you'll need to implement those yourself.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
And the way to know if you can use the compiler generated ones or not is to look at the constructor/destructor members: If there is any new/delete in either of those, you will (almost always) have to make your own assignment operator and copy constructor.
In fact, if there is a destructor, then you PROBABLY need a cop constructor and assignment operator.
http://en.wikipedia.org/wiki/Rule_of...2B_programming)
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.