Definition of the Liskov substitution principle: If a software entity is using a base class, it must be applied to its subclasses, and the difference between the base class object and the subclass object cannot be detected at all.
1) How to understand the above concept? Is that the subtype of our programming can completely replace the parent type without any change in the behavior of the client that invokes the parent type.
2) What is the meaning of this principle? This principle is mainly to ensure that the code is open to the extension, as long as the subclass can completely replace the behavior of the base class, the new specific subclass in the overloaded parent class, will not have any adverse effect on the customer code, thus implementing the extension open.
At design time, we can use this principle to determine whether the subclass of our design is reasonable. Think: squares are designed into rectangular subclasses, OK?
Software Design----Liskov replacement principle (LSP)