I have two abstract classes Business & Person. The problem is that I have a customer type that can be either a Business or a Person. Is there a way to model this so that I don't have both CustomerBusiness and CustomerPerson classes? Multiple inheritance isn't an option as this is C#. I've been looking at this so long I can't see the forest for the trees.
public abstract class Business {
public string Name { get; set; }
}
public abstract class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
public string MiddleName { get; set; }
public DateTime? BirthDate { get; set; }
public string Comments { get; set; }
}
public class CustomerBusiness : Business, CustomerRoles {
public bool BillTo { get; set; }
public bool ShipTo { get; set; }
public bool DeliverTo { get; set; }
public EntityType Type { get; set; }
}
public class CustomerPerson : Person, CustomerRoles {
public bool BillTo { get; set; }
public bool ShipTo { get; set; }
public bool DeliverTo { get; set; }
public EntityType Type { get; set; }
}
public interface CustomerRoles {
bool BillTo { get; set; }
bool ShipTo { get; set; }
bool DeliverTo { get; set; }
}