Defination:-Copy Constructor creating a new object from existing object of same .When we do not define a copy constructor .compile provide a default copy constructor.when there is a object owns a pointer variable and a reference non shareable.Use of const Keyword becose The const is there to ensure that you don't modify the
Signature of copy Constructor
MyClass
{
Public:
MyClass()
{
}
MyClass(const MyClass&)
{
}
};
or another ex
other object.Signature of copy Constructor
MyClass
{
Public:
MyClass()
{
}
MyClass(const MyClass&)
{
}
};
or another ex
X(const X& copy_from_me); X(X& copy_from_me); X(const volatile X& copy_from_me); X(volatile X& copy_from_me); X(const X& copy_from_me, int = 10); X(const X& copy_from_me, double = 1.0, int = 40);
Comments
Post a Comment