![]() |
Define copy constructor? What is the use of copy constructor?
# Define copy constructor? What is the use of copy constructor?
|
Re: Define copy constructor? What is the use of copy constructor?
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 |
Re: Define copy constructor? What is the use of copy constructor?
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 |
| All times are GMT +5.5. The time now is 02:06. |