A

Admin • 833K Points
Coach

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

  • (A) class obj;
  • (B) obj = new class;
  • (C) class obj = new class();
  • (D) ClassName obj;
  • Correct Answer - Option(D)
  • Views: 16
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

In C++, objects are created using the class name followed by the object name, like 'ClassName obj;'.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.