in reply to Re: Change the parent of an instance in thread Change the parent of an instance
Might be a good idea, altough in this case many of the methods will be in an if-else manner, just because the two things share a lot although they hardly share anything.
I know it might look like I'm rejecting all advises, I'm aware of that, but the 'multimorphing' idea as it seems to be called is not very usable I think.
Re: Re: Re: Change the parent of an instance
by perrin (Chancellor) on May 11, 2004 at 18:44 UTC
|
What I'm suggesting is that you are thinking about it at the wrong level. What's important to your program might not be whether or not the object is a foe but rather whether or not it is carryable. Each kind of object may have unique rules about when it is carryable. In general, the idea is to push as much of the decision-making about how an object will behave in a certain situation into the object itself (by asking it with methods like this) rather than have some other code that decides what the object can do based on what type it is. | [reply] |
|