Code to the Interface means depending on a superclass interface instead of a specific subclass implementation. This lets one variable work with multiple subclasses through polymorphism. section 2.3.3
Shapes: replace a concrete dependency
A Rectangle pointer can call display(), but it works only with Rectangle. Replacing it with Shape* allows the same code to point to Rectangle or Circle; the runtime object determines which display() implementation runs.
Apply the principle by moving shared dependencies to the superclass interface:
- Store an Attributes* in Book rather than a FictionAttrs* or CookbookAttrs*; subclasses inherit changes to coordinate their behavior without code modification. section 2.3.3
- Store vector<Book*> in Catalogue so the collection can contain different book subclasses instead of depending on one concrete type. section 2.3.3
- Use polymorphic operations when behavior must vary at runtime; avoid unnecessary subclasses, runtime type checks, and type conversions that increase complexity. section 2.4

