R

Rakesh Kumar • 28.44K Points
Instructor II

Q. Which of the following is the correct way to define a copy constructor in C++?

  • (A) MyClass(const MyClass& other) { }
  • (B) MyClass(MyClass& other) { }
  • (C) Both A and B
  • (D) None of the above
  • Correct Answer - Option(A)
  • Views: 41
  • Filed under category C++

Explanation by: Rakesh Kumar
The correct way to define a copy constructor is 'MyClass(const MyClass& other) { }'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics