I am creating a series of interfaces / abstract classes that contain basic properties, and I would like to compute properties and multiple inheritance.
public abstract class /interface Modifiable
{
public DateTime ModifiedDate {get; set;}
public boo ModifiedToday
{
get { return DateTime.Now.AddDays(-1).CompareTo(ModifiedDate) >= 0; }
}
public bool ModifiedInLastWeek
{
get { return DateTime.Now.AddDays(-7).CompareTo(ModifiedDate) >= 0; }
}
}
public abstract class /interface Deletable
{
public DateTime DeletionDate {get; set;}
public bool Deleted
{
get { return DeletionDate != default(DateTime) }
}
}
Then I have a class that inherits from these two interfaces / abstract classes.
public class Something : Modifiable, Deletable
{
}
But a class cannot inherit from two abstract classes. Therefore, I then need to use interfaces, but with interfaces I cannot have method bodies. Then I have to define the exact same functions for several classes to implement these simple bool properties using interfaces.
, Deletable, , - , Deletable. , .
, , , , ?