Beginner C++
Q27 / 100

What is a copy constructor?

Correct! Well done.

Incorrect.

The correct answer is B) A constructor that initializes an object as a copy of another object of the same type

B

Correct Answer

A constructor that initializes an object as a copy of another object of the same type

Explanation

MyClass(const MyClass& other) is called when passing by value or initializing from an existing object. If not defined, the compiler generates a shallow copy.

Progress
27/100