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

  • (A) MyClass() { }
  • (B) void MyClass() { }
  • (C) int MyClass() { }
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) MyClass() { }
Explanation: The correct way to define a constructor is 'MyClass() { }'.
Explanation by: Vijay Sangwan
The correct way to define a constructor is 'MyClass() { }'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
176
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Vijay Sangwan
Publisher
πŸ“ˆ
96%
Success Rate