Hi, look in to this for more information on copy Constructor ! See, if you have a class , having pointer variables pointing to another class in that case if you want to new create object using existing one, and you want to use properties of existing object in to new except pointers (Otherwise both the object will point to same memory location) in that case you can use copy constructor for creating new instance from old one ! eg. Code: class SomeClass { AnotherClass *Ac; public SomeClass(Const SomeClass &SC ) { //Other Properties = SC.OthereProperties Ac=new AnotherClass(); } };
Hi, look in to this for more information on copy Constructor ! http://en.wikipedia.org/wiki/Copy_constructor See, if you have a class , having pointer variables pointing to another class in that case if you want to new create object using existing one, and you want to use properties of existing object in to new except pointers (Otherwise both the object will point to same memory location) in that case you can use copy constructor for creating new instance from old one ! eg. Code: class SomeClass { AnotherClass *Ac; public SomeClass(Const SomeClass &SC ) { //Other Properties = SC.OthereProperties Ac=new AnotherClass(); } }; -Anant