Multiple choice

What do you think would be the main advantage of creating constructor function in a class?

  1. It avoids creating private members in a class.

  2. Constuctor functions are automatically invoked when objects are created.

  3. It avoids creating friend function in a class.

  4. It avoids creating destructor function in a class.

  5. It avoids creating pointers to objects.

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

This is the main advantage of using a constructor function in a class.