For example, if I have a person class, but each instance of a person can have 0 or more position or job - which have specific abilities and responsibilities - that he/she can switch between at will.
Asked
Active
Viewed 58 times
-1
-
You'll be much better off asking a much more specific question that can be responded to with a specific answer. Also, your question is not clear. – SamTebbs33 Apr 03 '15 at 23:49
-
This description makes me think of many patterns. Strategy, Observer, Visitor, Command ... for one thing can a person hold many positions at the same time? Do we want to be able to say, "Do all your jobs". – candied_orange Apr 04 '15 at 00:07
-
Yes, I'll edit that in – geoxile Apr 04 '15 at 00:34
1 Answers
0
I think you can accomplish this with the Strategy Pattern. Basically, the strategy would be their job, but I would probably make a Worker
or Employee
class; not all Person
s are workers.
If a Person
encapsulates the notion of applying a strategy to accomplish their tasks or responsibilities they can switch tasks or responsibilities on the fly (runtime).

ChiefTwoPencils
- 13,548
- 8
- 49
- 75