This Week
This week we will look at, compare, and contrast two approaches to polymorphism in C++. We’ll look at runtime polymorphism, also known as dynamic polymorphism, through the use of inheritance to define sub-types with special behaviours. We’ll also discuss compile-time polymorphism, also known as static polymorphism, through the use of templates (and sometimes therefore referred to as template meta-programming) to define generic code which compiler can use to automatically generate specialised code for different types.
- Inheritance
- Creating sub-types using inheritance
- Overriding functions
- Runtime polymorphism with virtual functions
- Abstract classes for interfaces
- Templates
- Function templates
- Class templates
- Operator & function overloading
- Compiling templated code