Interview Question

Created by admin on Sat, 17/11/2012 - 15:21
Question: 

Define precondition and post-condition to a member function?

Language: 
Answer: 
Precondition:A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold. For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full.