Created
June 17, 2015 11:21
-
-
Save smudge202/f4ca0f0157d02c058edf to your computer and use it in GitHub Desktop.
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 IAnimal | |
{ | |
string Type { get; } | |
} | |
public abstract class Dog : IAnimal | |
{ | |
public virtual string Type { get; } = "Dog"; | |
public abstract string Breed { get; } | |
} | |
public class Huskey : Dog | |
{ | |
public override string Breed { get; } = "Huskey"; | |
} | |
public class DogConsumer | |
{ | |
public DogConsumer(Dog dog) | |
{ | |
Console.Write($"Type: {dog.Type}, Breed: {dog.Breed}"); | |
} | |
} | |
public class AnimalConsumer | |
{ | |
public AnimalConsumer(IAnimal animal) | |
{ | |
Console.WriteLine($"Type: {animal.Type}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment