I remember in Java once the parent class implements the interface, then all child classes of the parent is now implicitly of type interface (becoming a "super" interface if you will).
public interface IAnimal
{
// Empty
}
// Parent class
public abstract class Mammal : IAnimal
{
public string Genus { get; set;}
public string Species { get; set; }
}
public class Dog : Mammal // Dog should be of type IAnimal now?
{
public string FurColor { get; set; }
}
// Some service class that returns a list of Dog objects
public List<Dog> GetMyDogs()
{
// Build list using Dog class
}
// Consumer
List<IAnimal> animals = GetMyDogs(); // Throws Cannot implicitly convert type Dog to IAnimal
Is the same capability available in C#?