File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public Bird(string name, bool canFly)
1313
{
1414
this.name = name;
1515

16-
this.flyingType = canFly ? new ICanFly() as IFlyingType : new ICantFly();
16+
this.flyingType = canFly ? new ICanFly() : new ICantFly();
1717
}
1818

1919
public override void Talk()
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public Fish(string name, bool canFly)
1313
{
1414
this.name = name;
1515

16-
this.flyingType = canFly ? new ICanFly() as IFlyingType : new ICantFly();
16+
this.flyingType = canFly ? new ICanFly() : new ICantFly();
1717
}
1818

1919
public override void Talk()
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public Mammal(string name, bool canFly)
1313
{
1414
this.name = name;
1515

16-
this.flyingType = canFly ? new ICanFly() as IFlyingType : new ICantFly();
16+
this.flyingType = canFly ? new ICanFly() : new ICantFly();
1717
}
1818

1919
public override void Talk()
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ void Start()
1717

1818
Mammal bat = new Mammal("bat", canFly: true);
1919

20-
Fish flyingFish = new Fish("Flying fish", canFly: true);
20+
Fish flyingFish = new Fish("flying fish", canFly: true);
21+
22+
Fish goldFish = new Fish("goldfish", canFly: false);
2123

2224

2325
ostrich.Talk();
@@ -29,6 +31,8 @@ void Start()
2931
bat.Talk();
3032

3133
flyingFish.Talk();
34+
35+
goldFish.Talk();
3236
}
3337
}
3438
}

0 commit comments

Comments
 (0)