Multiple choice

Which of the following represents the constructor of the class given below? class Student { private: int roll_no; float marks; };

  1. int Student() { roll_no=0; marks=0.0; }

  2. void Student() { roll_no=0; marks=0.0; }

  3. Student() { roll_no=0; marks=0.0; }

  4. Students() { roll_no=0; marks=0.0; }

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

 This option is correct as a constructor always has same name as its class with no return type, not even 'void'.