Define precondition and post-condition to a member function?
Answer / akhilesh kumar jaiswal
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. We say that isful() is a precondition of the push operation.
Post-condition:
A post-condition is 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 if 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.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are static type checking?
How can you force instantiation of a template?
What is the difference between new() and malloc()?
what are difference between c and c++?
What is an iterator class in c++?
What is the use of 'using' declaration in c++?
Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
What is const pointer and const reference?
What is stack unwinding?
What is c++ redistributable?
How can you quickly find the number of elements stored in a static array?
Difference between Top down and bottom up approaches for a given project ?
14 Answers BSNL, CSC, HCL, HP, IIT, Infosys, Siemens,