πŸ“Š C++
Q. Which of the following is the correct syntax for a constructor in C++?
  • (A) void Constructor() {}
  • (B) Constructor() {}
  • (C) Constructor(void) {}
  • (D) void constructor() {}
πŸ’¬ Discuss
βœ… Correct Answer: (B) Constructor() {}

Explanation: A constructor in C++ has the same name as the class and no return type.

Explanation by: Gopal Sharma
A constructor in C++ has the same name as the class and no return type.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
163
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Gopal Sharma
Publisher
πŸ“ˆ
91%
Success Rate