![]() ![]() So what in the world does all that mean? It means that our derived classes (or implementing classes) cannot modify or break the functionality dictated by their base classes or implemented interfaces. Methods that use references to base classes (or interfaces) have to be able to use methods of the derived classes without knowing about it or knowing the details. ![]() Derived classes should be substitutable for their base classes (or interfaces).In a nutshell, the Liskov Substitution Principle includes two main points: Let’s reword the definition above to actually be understandable. The Liskov Substitution Principle states that if for each object m1 of type S there is an object m2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when m1 is substituted for m2 then S is a subtype of T. We will however take a look at how to segregate interfaces in pursuit of not violating the Liskov Substitution Principle. While discussing the Liskov Substitution Principle, we are going to take a quick dive into the Interface Segregation Principle as well, but not overly so as the next post will discuss that more deeply. ![]() In this post we are going to dive into this design principle and work with a very simple example in C#.Īs you study the SOLID Design Principles, you will notice there is a great deal of overlap among the individual principles. In our introduction to the SOLID Design Principles, we mentioned the Liskov Substitution Principle as one of the five principles specified. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |