Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Define precondition and post-condition to a member function?



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

Post New Answer

More C++ General Interview Questions

Differentiate between the message and method?

1 Answers  


What are the advantages of using friend classes?

0 Answers  


How come you find out if a linked-list is a cycle or not?

0 Answers  


What is class in c++ with example?

0 Answers  


What is doubly linked list in c++?

0 Answers  


What methods can be overridden in java?

0 Answers  


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

0 Answers  


When to use Multiple Inheritance?

6 Answers  


what do you mean by memory management operators

4 Answers   HCL,


What is an incomplete type?

1 Answers  


What does asterisk mean in c++?

0 Answers  


Given the following function definition: int doit(int &x, int y, int &z) { x = 3*x; y = y + 5; z = x+y; return z - 4; } int a = 5, b = 7, c = 9, d = 11; d = doit(a,b,c);

2 Answers  


Categories