We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c640b1c commit f05537cCopy full SHA for f05537c
3_LSP_code_refactor.md
@@ -0,0 +1,27 @@
1
+> Based on the problem with Ostriches trying to fly, we should consider removing Fly from our base Bird class
2
+
3
+ class Bird { }
4
5
+ class FlyingBird {
6
+ void Fly() { return "fly"; }
7
+ }
8
9
+ class Dove : FlyingBird {
10
+ void Fly() { return "flap"; }
11
12
+ class Eagle : FlyingBird {
13
+ void Fly() { return "soar"; }
14
15
+ class Ostrich : Bird { }
16
17
+> Now we can make all flying birds, fly:
18
19
+ this.flyingBirds = new List<FlyingBird>();
20
+ this.flyingBirds.Add(new Dove());
21
+ this.flyingBirds.Add(new Eagle());
22
23
+ foreach(var flyingBird in this.flyingBirds) {
24
+ flyingBird.Fly(); //success!
25
26
27
+[« back to readme.md](README.md)
0 commit comments