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

Is there finally in c++?

1088


How are virtual functions implemented in c++?

1056


Is atoi safe?

1044


What is the fastest c++ compiler?

1091


What is a down cast?

1096


How can an improvement in the quality of software be done by try/catch/throw?

1047


Which bit wise operator is suitable for turning off a particular bit in a number?

1104


What do you mean by const correctness?

1071


Is c++ a software?

1179


What does override mean in c++?

1056


How do you differentiate between overloading the prefix and postfix increments?

1077


what are function pointers?

1029


How to declare an array of pointers to integer?

1125


What are c++ storage classes?

1080


What is the two main roles of operating system?

1025