Let's say that I have an abstract base class something simple like
abstract class Item : IDisplayable
{
public int Id { get; set; }
public string Name { get; set; }
public abstract void Print();
}
and I have a class that inherits from that like
class Chair: Item
{
public int NumberOfLegs {get;set;}
public void Print()
{
Console.WriteLine("Here is a simple interface implementation");
}
}
interface IDisplayable
{
void Print();
}
the child class does not explicitly say that it also implements the Interface, and yet it will do so through simple inheritance. If we explicitly add the Interface to the child classes the program will run the same (at least as far as I can tell in my simple examples). Would explicitly implementing the interface be a good or bad idea, or is it strictly a matter of preference?