June 2025
Intermediate to advanced
1093 pages
33h 24m
English
If you decide not to use virtual methods, there are other ways in C++ to make data types extensible. You can add functionality by overloading free functions. Linking types using type traits is an advanced topic. For this, you need to learn more about template programming. You can find a brief introduction in Chapter 23.
Feel free to use virtual methods generously. They offer a good compromise between understandability and performance. If you ever deal with special applications, you can always learn other methods.
A general note on inheritance: Practice the technique of inheritance and use it to reduce code duplication. But don't overuse the concept. Much more often than the is-a relationship, inheritance, ...
Read now
Unlock full access