[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Technical Discussion :: C++

30. What is Copy Constructor? Write a program using it.

Answer:

Copy constructor is used to declare and initialize an object from another object.
For example, the statement
Integer I2(I1);
Would define the object I2 and at the same time initialize it to the values of I1. another form of this statement is integer I2=I1;
The process of initializing through a copy constructor is known as copy initialization. A copy constructor takes a reference to an object of the same class as itself as an argument.

Asked In :: Capgemini Syntel Inc. Societe Generale

Post Your Answer Here:

Name *
Email
Alert me

Post Your Reply Here:

Report Error

Please Login First Click Here