I need to know if a redefined function in Eiffel can define its own assertions.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes it can. But a redefined feature can only weaken its parent’s precondition and strengthen its postcondition. To make it clearer you are forced to declare your precondition as a
require elsein the redefined feature, and declare the postcondition as anensure thento make it clear that you are weakening/strengthening the corresponding assertion.See the documentation site for a more in depth explanation.