Merge branch 'dev' of rajukottedi/chirpy-blogging into prod
This commit is contained in:
commit
5a0ff70502
@ -75,7 +75,7 @@ public class Square : Shape
|
||||
## 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**.
|
||||
|
||||
**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#
|
||||
// Before
|
||||
|
||||
Loading…
Reference in New Issue
Block a user