Subclass can strengthen the invariants and postconditions of the inherited contract and can only
weaken its preconditions. This is because if the precondition of the subclass method is strengthened, the method will not able to execute if a superclass is being substituted with the subclass. So we can only weaken its preconditions.
No comments:
Post a Comment