 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
A
virtual base class is specified in our class derivation
|
|
|
lists,
with the keyword virtual before each common base
|
|
|
class
name as part of the base class header.
|
|
class common_base {...};
|
|
class base_1 : virtual public
common_base {...};
|
|
class base_2 : virtual public
common_base {...};
|
|
class derived : public base_1, public
base_2 {...};
|
|
|
| • |
Each
path leading from the derived class to the common
|
|
|
base
class must specify that the common base class is a
|
|
|
virtual
base class.
|
|
|
| • |
If
the common base class is not a direct base class of the
|
|
|
derived
class, then the derived class does not need to use
|
|
the
keyword virtual in the derivation list
|
|