开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜