[Advices] C++ Fundamentals

  • If two classes have a common interface, make the interface an abstract class
  • If the implementations of two classes have something significant in common, make that commonality a base class
  • If a class is a container of objects, make it a template
  • If a function implements the algorithm for a container, make it a template function implementing the algorithm for a family class
  • If a set of classes, templates, etc are logically related, place them in common namespace

(via The C++ Programming Language, Third Edition by Bjarne Stroustrup, page 16)