Problem Statement
Explain constructor chaining and how it supports object initialization in class hierarchies.
Explanation
Constructor chaining is when one constructor calls another constructor in the same class (or base class) to reuse initialization logic. In languages like Java you use `this(...)` to call another constructor in the same class, or `super(...)` to call the base class constructor. In C++ the base class constructor is called before the derived class constructor body executes. This ensures that shared initialization code is executed only once, and simplifies object construction across class hierarchies.
Practice Sets
This question appears in the following practice sets: