Repeated inheritance example.
Repeated | Repeated inheritance example. |
Overview | The simplest and most obvious use of multiple inheritance is to “glue” not related classes together, as part of the implementation of a third class. |
Base | Base class |
Enumerations | |
ReturnValue | Return value enumeration |
Functions | |
~Base | Public destructor |
Base | Public constructor |
ConstFunction | Const function returning a const value |
ConstReturn | Function returning a const * const value |
NothrowFunction | A nothrow function |
ReturnValueFunction | A function with a typed return value |
StaticFunction | Static function returning a const value |
ThrowFunction | A throw function |
VectorFunction | A function returning a vector of ints |
VirtualConst | A const pure virtual function |
DerivedA | DerivedA class |
Functions | |
= | Assigment operator |
~DerivedA | Public destructor |
DerivedA | Public constructor |
DerivedB | DerivedB class |
Functions | |
= | Assigment operator |
~DerivedB | Public destructor |
DerivedB | Public constructor |
Top | Top class |
Functions | |
= | Assigment operator |
~Top | Public destructor |
Top | Public constructor |
The simplest and most obvious use of multiple inheritance is to “glue” not related classes together, as part of the implementation of a third class.
void main( void ) { DerivedA devivedA; Top top; }
Hello from Base 1 Hello from Derived A Hello from Base 2 Hello from Derived A Hello from Derived B Hello from TOP 2 ByeBye from TOP ByeBye from Derived B ByeBye from Derived A ByeBye from Base 2 ByeBye from Derived A ByeBye from Base 1
mynamespace::Base |
class Base
Base class
Enumerations | |
ReturnValue | Return value enumeration |
Functions | |
~Base | Public destructor |
Base | Public constructor |
ConstFunction | Const function returning a const value |
ConstReturn | Function returning a const * const value |
NothrowFunction | A nothrow function |
ReturnValueFunction | A function with a typed return value |
StaticFunction | Static function returning a const value |
ThrowFunction | A throw function |
VectorFunction | A function returning a vector of ints |
VirtualConst | A const pure virtual function |
To send feedback on this topic email: natural@gmai l.com docsplus
© Some Rights Reserved. see <License>
Base class
class Base
Return value enumeration
enum ReturnValue {
Public destructor
~Base()
Public constructor
Base( int data )
Const function returning a const value
unsigned ConstFunction() const
Function returning a const * const value
char const* const ConstReturn()
A nothrow function
int NothrowFunction( ) throw()
A function with a typed return value
Base::ReturnValue ReturnValueFunction()
Static function returning a const value
const unsigned StaticFunction()
A throw function
int ThrowFunction( ) throw(A, B)
A function returning a vector of ints
const std::vector<int> & VectorFunction()
A const pure virtual function
void VirtualConst() const = 0
DerivedA class
class DerivedA : virtual public Base
Assigment operator
DerivedA& operator=( const DerivedA& )
Public destructor
~DerivedA()
Public constructor
DerivedA()
DerivedB class
class DerivedB : virtual public Base
Assigment operator
DerivedB& operator=( const DerivedB& )
Public destructor
~DerivedB()
Public constructor
DerivedB()
Top class
class Top : public DerivedA, public DerivedB
Assigment operator
Base& Base::operator=( const Base& )