Originally posted by Pho Tek:
Say I have a [b]Person class.
And I have two roles which I want to model:
- Buyer
- Seller
How do you implement this ?
I've tried using interfaces.
e.g.
The problem I see here is that I can't changed my role
dynamically. For example, the program might allow a Person
to assume another role in the middle of the program.
Thanks
Pho[/B]
This maybe a late reply, but, heh, it's better never.
OK, maybe you can try like this: -
Person has a "1 to 0..*" composition relationship with PersonRole.
Place a Condition on the relationship like "Max 1 each".
PersonRole is an abstract class.
Both Buyer and Seller inherits from PersonRole.
This way, Person can have zero or a max of either Buyer or Seller role.
------------------
Thank you.
- Simon See
simon-ivy@usa.net -after office hours-
necro-mani-cide