June 2025
Intermediate to advanced
1093 pages
33h 24m
English
Signature classes are nothing additional in C++; they don’t have additional syntax requirements or keywords. They are just a name for a special form of things you already know: a class that only has pure virtual methods is a signature class. As a reminder, a pure virtual method is a virtual method without implementation, which is noted in the source code with = 0. Some other languages, like Java, for example, call such methods abstract.
A signature class is shown in the next listing.
// https://godbolt.org/z/rW4oTPhrGstruct Driver { virtual void init() = 0; virtual void done() = 0; virtual bool send(const char* data, unsigned len) = 0;};
Listing 18.9 A signature class has only pure virtual methods. ...
Read now
Unlock full access