[ Team LiB ] Previous Section Next Section

Gotcha #93: Concrete Public Base Classes

From the design point of view, public base classes should generally be abstract, because they represent abstract concepts from the problem domain. Just as we don't want or expect to see abstractions wandering around in our physical space (imagine, for example, what a generic employee, fruit, or I/O device might look like), we don't want objects of abstract interfaces wandering around in our program space.

In C++, we also have practical concerns related to implementation. We're primarily concerned with slicing and associated issues such as the implementation of copy operations (see Gotchas #30, #49, and #65). In general, public base classes should be abstract.

    [ Team LiB ] Previous Section Next Section