Last active
December 12, 2015 10:09
-
-
Save PetersonDave/4756980 to your computer and use it in GitHub Desktop.
How to handle scenario where we want to use related interfaces, but have a common interface within an abstract class?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Interface IBrewCoffeee | |
{ | |
void DoSomething; | |
} | |
Public Interface IStarbucksBrewsCoffee | |
{ | |
void DoSomething; | |
void DoSomething1; | |
void DoSomething2; | |
} | |
Public Interface IDunksBrewsCoffee | |
{ | |
void DoSomething; | |
void DoSomethingElse; | |
} | |
public abstract class CoffeeHouse | |
{ | |
public CoffeeHouse(IBrewCoffee) { ... } | |
} | |
Public Starbucks : CoffeeHouse | |
{ | |
public Starbucks(IStarbucksBrewsCoffee starbucksBrewsCoffee) : base(starbucksBrewsCoffee) { } | |
} | |
Public Dunks : CoffeeHouse | |
{ | |
public Dunks(IDunksBrewsCoffee dunksBrewsCoffee) : base(dunksBrewsCoffee) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use interface inheritance:
IStarbucksBrewsCoffee : IBrewCoffeee
IDunksBrewsCoffee : IBrewCoffeee