Le lundi 26 juin 2006 22:37, [EMAIL PROTECTED] a écrit : > Won't work because there will be employers that aren't workers. > And yes, only some workers will become employers, but also only some > employers will also be workers (at some point in program). Let me be > more clear: > > workers > --> subset of workers --become--> employers > employers > --> subset of employers --become--> workers > > It is very important that both should maintain attribute values, > regardless of whether they take on new "roles". Furthermore, this is a > very simple case and ultimately in my program an object should be able > to dynamically take on a multitude of roles (classes of behavior) > without mucking at all with their pre-existing states.
This seem to be a OO design problem and you clearly make a misuse of inheritance, if a person can eventually have many roles, but doesn't have this role for all his lifetime, then the person *is* not his roles. That the meaning of inheritance, class B(A) means a B is a A. The association between a person and his roles is obviously a 1-n association, which can be rendered by different patterns (delegation, composition, strategy, etc.). You should google on "design patterns" and make your choice. -- _____________ Maric Michaud _____________ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-list