Professional Documents
Culture Documents
Definition
• In C++, constructor is a special method which is invoked
automatically at the time of object creation.
• Default constructor
• Parameterized constructor
• Copy Constructor
Default Constructor
Sample(Sample &t)
{
id=t.id;
}
• The process of initializing members of an object through a copy
constructor is known as copy initialization.