Multiple choice

Which one of the following is a default constructor? A. class star { private: int a; public: star(int a) { a=0; } }

B. class star { private: int a; public: star() { a=0; } } C. class star { private: int a,b; public: star(int a,int b) { a=0; b=0; } }

  1. A

  2. B

  3. C

  4. None of these

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

A default constructor takes no parameters. Option B has star() with no parameters, making it the default constructor. Options A and C have constructors with parameters (parameterized constructors), not default constructors.