The correct answer is: A. the parent class object must be constructed first.
When you create a derived class and instantiate an object, the parent class object must be constructed first. This is because the derived class inherits from the parent class, and the parent class’s constructor must be called before the derived class’s constructor can be called.
Here is an example:
“`class Parent {
public:
Parent() {
cout << “Parent::Parent()\n”;
}
};
class Child : public Parent {
public:
Child() {
cout << “Child::Child()\n”;
}
};
int main() {
Child c;
return 0;
}
“`
When this code is compiled and run, the following output is produced:
Parent::Parent()
Child::Child()
As you can see,
48.6-11.4 42.9-11.4 132.3-11.4 132.3s0 89.4 11.4 132.3c6.3 23.7 24.8 41.5 48.3 47.8C117.2 448 288 448 288 448s170.8 0 213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zm-317.5 213.5V175.2l142.7 81.2-142.7 81.2z"/> Subscribe on YouTube