Date Class’s Default Copy Constructor

As you study class Date (Fig. 9.17), notice that the class does not provide a constructor that receives a parameter of type Date. So, why can the Employee constructor’s member initializer list initialize the birthDate and hireDate objects by passing Date objects to their Date constructors? As we mentioned in Section 9.9, the compiler provides each class with a default copy constructor that copies each data member of the constructor’s argument object into the corresponding member of the object being initialized. Chapter 10 discusses how you can define customized copy constructors.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.156.93