P

Priyanka Tomar • 35.28K Points
Coach

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

  • (A) MyClass(int x, int y) { }
  • (B) void MyClass(int x, int y) { }
  • (C) int MyClass(int x, int y) { }
  • (D) None of the above
  • Correct Answer - Option(A)
  • Views: 60
  • Filed under category C++

Explanation by: Priyanka Tomar
The correct way to define a constructor with parameters is 'MyClass(int x, int y) { }'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics