When is a copy constructor invoked?
-
A
When a static member is assigned
-
B
When an object initialises another of its type
Correct answer
-
C
When a class declares a new object
-
D
When a virtual call is made on an object
Correct answer
B. When an object initialises another of its type
13 views
Explanation
The copy constructor runs whenever a new object is created from an existing object of the same class.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ