Skip to main content

Practice · 2 of 3

Predict construction order

CHALLENGE
Difficulty: intermediate+25 XP

Implement class Parent with a constructor printing parent and a destructor printing ~parent, and class Child : public Parent whose constructor prints child and destructor prints ~child. Use std::cout exactly (no extra text). The test captures construction/destruction inside a scope.

Back to lesson: Practice: Inheritance mechanics