Subclasses and abstract classes in DDD
I have an abstract ba开发者_开发技巧se class called Person with subclasses Employee and Customer.
How do you deal with the situation where Employee is also a Customer? How would this series of entities be created?
Cheers
If you want Employee to be a Customer, then Customer probably should not derive from person, but be it's own hierarchy of classes, which (typically) encapsulates a Person.
In many ways this makes more sense, since a Customer may also be a company or other form of entity, and not a Person.
精彩评论