Object-Oriented Program - Best Practices - Jon Kalb [ C++ on Sea 2020 ]
C++ Coding Standards, Rule 38: “Practice safe overriding”
After the base class guarantees the preconditions and postconditions of an operation, any derived class must respect those guarantees. An override can ask for less and provide more, but it must never require more or promise less because that would break the contract that was promised to calling code.
Use OOP to model “is-a” relationships, not for code-reuse
- Base class defines an interface for an object that might provide a type of functionality
- Derived classes provide implementations of different expressions of that object type
C++ Coding Standards, ite