Introduction to OOP: Chapter 10: Subclasses and Subtypes
[next]
[previous]
[audio]
[real]
[text]
Binding in C++
-
Instances of classes are statically typed and are not polymorphic,
pointers and references can hold polymorphic values.
-
Values do not have any type information (*)
-
Method binding can optionally be performed using dynamic class for
pointers and references.
-
Legality of message passing checked at compile time based on static type.
-
No facilities for the testing of reverse polymorphism (*)
-
Assignment of reverse polymorphic variables can be performed using a cast.
(However, validity of this conversion is not checked at run-time).
Intro OOP, Chapter 10, Slide 17
(*) This has changed somewhat since the introduction of the RTTI system.
I discuss the issue of polymorphism in C++ in more detail in my later
book, C++ for Java Programmers