R

Rakesh Kumar • 28.44K Points
Instructor II

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: 49
  • Filed under category C++

Explanation by: Rakesh Kumar
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.


Question analytics