Whit is the mean of precondition and post-condition to a member function.

Whit is the mean of precondition and post-condition to a member function.

Precondition is defined as a condition that must be true on entry to a member function. If preconditions are never false it means class is used correctly . 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. We say that isful() is a precondition of the push operation. Post-condition is defines as a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly when post-conditions are never false. For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.

By:Umang
Date:2003-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher