![]() Properties Rule – History ConstraintĪ precondition should be satisfied before a method can be executed. Private int postcondition: speed = 0, and this is perfectly fine.Ĭonversely, if the class invariant is not preserved by the subtype, it breaks any client code that relies on the supertype. ![]() So, let's make FixedTermDepositAccount a subclass of Account: public class FixedTermDepositAccount extends Account 3.5. In order to do that you need to swap the child (square) class with parent (rectangle) class to fit the definition of a square having four equal sides but a derived class does not affect the behavior of the parent class so if you will do that it will violate the Liskov Substitution Principle. This implies inheritance in our object-oriented design. A fixed-term deposit account in the real world “is a” type of account. To support this, let's introduce a new FixedTermDepositAccount class. ![]() ![]() God instituted the principle of substitution in the Garden of Eden when Adam and Eve sinned. The substitution principle Authors Sven Ove Hansson 1, Linda Molander, Christina Rudén Affiliation 1 Royal Institute of Technology, Dept. The bank now wants to offer a high interest-earning fixed-term deposit account to its customers. The Liskov substitution principle states that if a method uses a base class, then it should be able to use any of its derived classes without the need of having. Question What is the doctrine of substitution Answer Substitution is one of the major themes of the Bible. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |