Added a second implementation (#21944)
So it will highlight, that an interface can have multiple implementations (which differs) at the same time
This commit is contained in:
committed by
Christopher McCormack
parent
f7199d8a8d
commit
8e5e3a7db0
@ -55,3 +55,21 @@ public class UserHungry : IUserFavoriteFood
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Every implementation can be different:
|
||||||
|
```csharp
|
||||||
|
public class AnotherUserHungry : IUserFavoriteFood
|
||||||
|
{
|
||||||
|
public AddFood()
|
||||||
|
{
|
||||||
|
// DIFFERENT Implementation:
|
||||||
|
// A method to add vegan food.
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<User> EatFavoriteFood(int id)
|
||||||
|
{
|
||||||
|
// DIFFERENT Implementation:
|
||||||
|
// A method to Eat only vegan food by id.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user