Lecture overview -- Keyboard shortcut: 'u'  Previous page: Inheritance and Contracts -- Keyboard shortcut: 'p'  Next page: Class invariants in the triangle class hierarchy -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Contracts and Assertions - slide 24 : 32

Subcontracting

Due to polymorphism an instance of a subclass can act as stand in for an instance of the superclass

Consequently, the contracts of the subclass must comply with the contract of the superclass

The contract of a subclass must therefore be a subcontract of the superclass' contract

Operations in subclasses cannot arbitrarily redefine/override operations in superclasses