Delegating Constructors
In this lesson, you will learn two techniques from C++11 that allow us to reuse existing code from constructors.
We'll cover the following...
We'll cover the following...
Delegating constructors
Sometimes, when your class contains many data members and several constructors, it might be convenient to reuse their initialization code.
Fortunately, since C++11, you can use delegating constructors, which can call other constructors.
Let’s look at an example:
In the above example, we declare three constructors, and two of them call the “primary” one, which performs the core job. Inside this main constructor, we not only initialize ...