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

  • (A) class MyClass { };
  • (B) class MyClass { public: };
  • (C) class MyClass { private: };
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
Explanation: All the options are valid ways to define a class in C++.
Explanation by: Shiva Ram
All the options are valid ways to define a class in C++.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
172
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Shiva Ram
Publisher
πŸ“ˆ
86%
Success Rate