Multiple choice

Which of the following is the correct syntax of declaring a class in C++?

  1. class classname {varibale declaration function declaration};

  2. class {variables; function;};

  3. class classname{variables function};

  4. class classname;{ };

  5. class classname {member variables; member function;}

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This is the correct syntax of declaring a class and members of the class.