PRE/POST on methods:

When applied to a method, the semantics provide support for the "Design by 
Contract" style of OO programming: a precondition of a particular method is met 
if all the PRE blocks associated with that method return true. Otherwise, the 
precondition is met if all of the parent classes' preconditions are met (which 
may include the preconditions of their parent classes if they fail, and so on 

In contrast, a method's postcondition is met if all the method's POST blocks 
return true and all its parents' postconditions are also met recursively.

If the PRE blocks on the method don't all return true, it appeals to the 
preconditions on the base class of the class defining the method?  I don't get 
it.  Why would a class-level precondition override a method-level precondition? 
 Why bother defining them on the method, if they are ignored if they are false 


Reply via email to