Hi, I think I see what you are trying to achieve. A useful pattern (see my previous post) would be the "Command" pattern. It nicely handles separating an invoker (Menu, gui, Switch etc) from an target (Light). It does this be creating a common "Command" base class from which concrete commands are derived. From you explanation below, you derived the Light from the Event (command) but this could be quite cumbersome if you needed many different commands with different actions. Better to give a concrete implementation command knowledge of how to invoke a command on the target. As an added benefit, one you start using commands, you can reasonable easily implement Macros (a command that maintains a list of other commands to execute when called) and undo/redo. So for you example something like: *** NOT TESTED OR COMPLETE CODE *** // Abstract Base Class: Command class Command { public: virtual ~Command(); virtual void Execute() = 0; private: Command(); // Private Constructor }; class Light { void TurnOn(); void TurnOff(); bool IsOn(); // etc... }; class Switch { void AttachCommand( Command *pCmd ); // Call when switch even happens void Invoke() { m_pCmd->Execute(); }; private: Command *m_pCmd; // Or this could be a list etc.. } // A Command to turn on a light class LightOnCommand : public Command { public: // when constructed, we will need a target LightOnCommand( Light *pTargetLight ); virtual void Execute(); private: Light *m_pTargetLight; }; // Implementation of LightOnCommand LightOnCommand::LightOnCommand( Light *pTargetLight ) { m_pTargetLight = pTargetLight; } void LightOnCommand::Execute() { m_pTargetLight->TurnOn(); } You could also implement a LighOffCommand or a LighToggleCommand To use (in your manager that sets it all up) Light ALight; Switch ASwitch; Command *pCmd; pCmd = new LighOnCommand( &ALight ); ASwitch.AttachCommand( pCmd ); ASwitch.Invoke(); This may look like a lot of work, but simple commands that don't need any arguments to their targets can be implemented with templates. The main benefit is that you can easily extend the commands, by adding new ones at any time. The Invoker (Switch) doesn't care what they do it knows only one interface (Command). The concrete commands (LightOnCommand) can be tightly coupled to their targets if you really need to (you can have then created solely by the target class if you need and so completely hide them from the rest of the application). You can also easily add things like macros and undo/redo. Cheers, Ash. --- Ashley Roll Digital Nemesis Pty Ltd www.digitalnemesis.com Mobile: +61 (0)417 705 718 > Consider a SWITCH object that needs to signal another object > when a given > switch is opened or closed. You could derive a LAMP object > from an EVENT > object that knows about switch_on and switch_off events. Then when the > SWITCH object needs to signal the LAMP it can do so via the > correct EVENT > method. You would then extend the EVENT class to encompass > all sorts of > events because you have many components in your system. The > problem now is > that your EVENT class must know about all the possible types > of events that > can occur AND your event generating objects and your event processing > objects must agree on the signalling method. This can get > very messy very > quickly especially if you want to connect an event generator to an > incompatible event processor. Say you have a LAMP object that has two > switches attached one for on/off and the other for full > brightness / dim. > > By using pointers to member functions you can obviate the > need for a special > EVENT class, you can get rid of the messy mapping mechanism, > you end up with > a succinct solution. > > In essence you keep knowledge of the workings of the objects > better hidden > from each other, you don't smear the logic halfway across your source. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads