.
, , :
public class Person
{
public Guid Id { get; set; }
public string Name { get; set; }
public string LastName { get; set; }
}
public class Employee : Person
{
}
, - , , .
, , , , , .
, :
public interface ICanBeUniquelyIdentifiable
{
Guid Id { get; set; }
}
... and we do not sell it on Person, but do it on Employee:
public class Employee : Person, ICanBeUniquelyIdentifiable
{
}
Background
I would say that your reasoning should be that you implement interfaces, where they really matter for implementation , and reuse should not be a key point in implementing interfaces.
In fact, you have to implement interfaces for objects that must be accepted on some kind of API, and you just need a subset of the full type of this object.
source
share