Constructor Delegation
In this lesson, we will further build on the idea of an initializer list in a constructor.
We'll cover the following...
We'll cover the following...
So far, we’ve seen how class members can be initialized in the constructor through an initializer list. However, we are not restricted to just that.
Definition #
Constructor delegation occurs when a constructor calls another constructor of the same class in its initializer list.
struct Account{
Account(): Account(0.0){}
Account (double b): balance(b){} };
In the example above, the default constructor calls the parameterized ...