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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

List the merits and demerits of declaring a nested class in C++?

990


Why cstdlib is used in c++?

1001


How static variables and local variablesare similar and dissimilar?

1009


What is this weird colon-member (" : ") syntax in the constructor?

982


What are the uses of static class data?

1138


Explain how we implement exception handling in c++?

1018


What are the advantages of using a pointer?

1031


What is the difference between public and private data members?

1133


Describe linked list using C++ with an example.

1037


what is VOID?

1021


Explain shallow copy?

1006


Is rust better than c++?

1070


Which is the best c++ compiler for beginners?

1039


What is struct c++?

960


Does c++ support exception handling?

1018