 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
When
we explicitly define either a copy constructor or an
|
|
|
assignment
operator in a derived class, we are responsible
|
|
for
ensuring that the base class copy constructor and
|
|
|
assignment
operator are called. This is because when we
|
|
|
implement
our own copy constructor or assignment
|
|
|
operator,
the compiler no longer provides an implicit one
|
|
|
and
cannot guarantee that the base class copy constructor
|
|
|
or
assignment op are called.
|
|
|
| • |
For
the copy constructor, we specify the base class' copy
|
|
|
constructor
in the initialization list of the derived class'
|
|
|
copy
constructor.
|
|
student::student(const student
&s) : checking(s) {
|
|
...
|
|
|
• This works because a student object is a checking object; checking’s
|
|
|
constructor my be implicit or explicitly defined.
|
|