Steven D'Aprano writes:
> (4) Inheritance
>
> Contracts are inherited, unit tests are not.
What does "inherited" mean? Just that methods that are not overridden
retain their contracts?
Contracts are attached to interfaces, not to specifications. So when you have abstract base class, it defines contracts, and implementing classes must adhere to these contracts - the can only strengthen it, not weaken it.
This way the user code need pnly be aware of the specification, not the implementation.
So method that _are_ overridden retain their contracts.
This is precisely like with types, since types are contracts (and vice versa, in a way).
Elazar