Solid principles correction

This commit is contained in:
Bangara Raju Kottedi 2024-04-06 12:44:17 +05:30
parent 54c71e5ef9
commit e8ee51606b

View File

@ -75,7 +75,7 @@ public class Square : Shape
## 3. Liskov Substitution Principle (LSP): ## 3. Liskov Substitution Principle (LSP):
This Principle states that objects of a superclass should be substitutable with objects of its subclasses without affecting the correctness of the program. In simpler terms, **a subclass should behave in such a way that it does not break the functionality that the superclass expects**. This Principle states that objects of a superclass should be substitutable with objects of its subclasses without affecting the correctness of the program. In simpler terms, **a subclass should behave in such a way that it does not break the functionality that the superclass expects**.
**Example**: *Consider a program that expects objects of type FlyingBird. According to LSP, if you have a class Swan that inherits from FlyingBird, you should be able to substitute an instance of Swan wherever you expect an FlyingBird without breaking the program's functionality.* **Example**: *Consider a program that expects objects of type Bird. According to LSP, if you have a class Swan that inherits from Bird, you should be able to substitute an instance of Swan wherever you expect an Bird without breaking the program's functionality.*
```c# ```c#
// Before // Before