Question: C++ requires that a derived class constructor calls its base class constructor if the base class has no default constructor. This is because Question 1

C++ requires that a derived class constructor calls its base class constructor if the base class has no default constructor. This is because

Question 1 options:

if there is no default constructor in the base class and the derived class does not call a base class constructor, a random base class constructor will be executed.

if there is no default constructor in the base class and the derived class does not call a base class constructor, no base class constructor will be executed.

if there is no default constructor in the base class and the derived class does not call a base class constructor, the compiler will not be able to create a default constructor for the base class.

if there is no default constructor in the base class and the derived class does not call a base class constructor, the compiler will select the first defined base class constructor to execute which may not be what the programmer wants.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!