So now you might wonder when and why constructor inheritance is useful.
So number one is ensuring base class initialization.
The base class person in our earlier example has fields name and age that must be initialized by calling
base name age.
We ensure that these fields are set up before the employee constructor continues with its own initialization,
so this is avoiding code duplication.
The initialization logic for name and age is centralized in the person class.
If these fields were initialized separately in every derived class, it would lead to code duplication
and potential errors.
If the initialization logic needed to be changed later on, and then maintaining invariant.
So the base class constructor can enforce certain invariants or validation checks.
For example, if the person class had validation logic for age, ensuring it's non-negative, this logic
would be reused automatically by all derived classes.
Then there is extensibility.
Derived classes can extend the initialization process by adding their own parameters and initializing
their own fields, while still leveraging the base class constructor for shared fields.
So you see, it's really useful and saves you a lot of code down the line, and also gives you a better
understanding of what's going on in more complex projects.