This chapter covers more deeply the subject of generics. Generics are classes and functions that can operate just as easily on objects as on primitive types. Qt container classes are generic, template-based classes, and we show the use of lists, sets, and maps. This chapter also discusses overloaded operators, managed containers, and implicit sharing.
C++ supports four distinct categories of types:
int, char, float, double, etc.
• Instances of
Because there is no common base type for these four distinct type categories, writing generic functions and classes that can operate on multiple type categories would be difficult without the use ...