Skip to content

Instantly share code, notes, and snippets.

@smudge202
Created June 17, 2015 11:21
Show Gist options
  • Save smudge202/f4ca0f0157d02c058edf to your computer and use it in GitHub Desktop.
Save smudge202/f4ca0f0157d02c058edf to your computer and use it in GitHub Desktop.
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