Designing character units

The following class diagram represents a reader:

As we go through the other character units, we will come up with a base class for each character unit. Each specific unit will inherit from that base class and will add its specific properties, if any. Here's the complete class diagram for character units:

Pay attention to the base class it's an interface rather than a regular class. It defines pure virtual functions to be implemented in derived classes. Here's what the CharacterUnit interface looks like in code:

Get Expert C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.