Define precondition and post-condition to a member function - C++

Define precondition and post-condition to a member function.

Pre-Condition :
A condition that should return true when a member function is invoked. In order to use a function correctly a precondition should return true. If a precondition fails to hold, an operation will not take responsibility to perform any action of sensibility. For example, the interface invariants of stack class respond nothing about pushing even though the stack is already full. In this scenario, sinful () is a precondition for push operation.

Post-Condition :
A condition that should return true before returning from an invoked function. In order to use a function correctly a post condition should return true. Taking a stack as an example, is empty () must necessarily be true after pushing the element into the stack when an element is pushed. The function is empty () is a post condition.
What is an array?
What is an array? - An array is a collection of variables of the same type that are referred to through a common name......
Define pointer and array. Explain the difference between them - C++
Define pointer and array. Explain the difference between them - A pointer is a variable that holds a memory address. This address is the location of another object (typically, a variable) in memory....
What is Dynamic memory management for array?
What is Dynamic memory management for array? - Using the new and delete operators, we can create arrays at runtime by dynamic memory allocation.....
Post your comment