previous | start | next

Review of C++: Inheritance

What is the syntax for definining a subclass B of a class A?

C++ has class types and also pointer to class types. I'll refer to the first as a value type and the second as a reference type.

Which of these types is polymorphic and which is monomorphic?

A variable declared as a monomorphic types may only hold different values during execution, but they must all be of one type specified by the declaration.

A variable declared as polymorphic type may not only hold different values during execution, but these may even be of different types.

A variable of type pointer to A, where A is a class is potentially a polymorphic type. During execution such a variable can hold values which are of type pointer to A or of type pointer to any class descended from A.



previous | start | next