Listing 1 is a simple case of multiple inheritance.
Listing 1: | simple |
Class C inherits from both class A and B. Because both inheritances are public, an object of class C has access to both i and j, which are data members defined in A and B, respectively.
Note that in the case of multiple inheritance, the keyword public needs to be applied to each superclass. Otherwise, the default private assumption is made.