5.7. How Abstract Should a Base Class Be?

Under our current design, the abstract base class provides an interface but does not provide an implementation. Each derived class must not only provide the unique algorithm for generating its elements but also provide support for finding the element, printing the element, maintaining the length and beginning position of the sequence object, and so on. Is this a bad design?

If the designer of the abstract base class is also providing the derived numeric sequence classes and if they are not expected to be added to very often, this design works quite well. If, however, a primary activity is the delivery of new numeric sequence classes and if that activity has been farmed out to individuals who are more ...

Get Essential 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.