in reply to Re-using/changing a class
Depending on the problem, a pattern that may fit very well is to have a base class and several classes that inherit from it (each one being a "state") and then call bless to change your object from one class to another, to another and back to the first.
If you want a particular method to be doing one of several fixed things, this is probably a much cleaner solution than what you are using right now.
|
|---|