[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++

25 / 187

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 :: CapgeminiSyntel Inc.Societe Generale

Post Your Answer Here:


Rate This: +1 -0      +
Report    

Post Your Reply Here:

Alert me
q4i-reply-your-answer

Report Error

Please Login First Click Here

Most Popular Qs.