Unit 02 of 02
Polymorphism and Structure
Inheritance and the base subobject, virtual functions and vtables, abstract classes, multiple inheritance and the diamond problem, exceptions, namespaces and type conversion operators — each paired with the question of which object an expression works with.
Published Updated
Lessons
- 01 Inheritance The measurement of whether the base subobject a derived object carries inside it stands at the same address, and is part of a single construction/destruction sequence. 1 min read
- 02 Virtual Functions and Vtables The measurement of whether a virtual call through a base pointer or reference always works with the same object, independent of the expression's static type. 1 min read
- 03 Abstract Classes and Interfaces The measurement of how a pure virtual function guarantees that no instance can be constructed from the base class, and that an interface is a pure contract carrying no data. 2 min read
- 04 Multiple Inheritance and the Diamond Problem The measurement of how the second base subobject in multiple inheritance does not share the same address as the derived object, and how a common ancestor in diamond-shaped inheritance doubles without virtual inheritance. 1 min read
- 05 Exceptions The measurement of how many times a thrown object is copied while being caught, which parts a construction cut short by an exception destroy, and how a temporary object is copied fewer times than a named local. 1 min read
- 06 Namespaces and Code Organization The measurement of how two symbols with the same name are separated by namespaces, and that a using declaration and a namespace alias are not a new symbol but an access path to an existing one. 2 min read
- 07 Type Conversion Operators The measurement of whether static_cast, dynamic_cast, const_cast, and reinterpret_cast access a reference as a part of an existing object or as a copy in a new one, depending on the target type. 11 min read