On Oct 30, 2008, at 11:01 AM, fargo@rpgportland.com wrote:
Is there a way to create a class.parent without having a property on
the class?
For instance say I have a class called Engine, then I have an array of
Valve classes. The array is a property of Engine.
Engine.Valves()
However now I want the valve to communicate with the Engine, to notify
the engine when it fails, do I create a property on the valve class
called parent and set that to be my engine, or is there some fancy
trick I can use to probe the valve and figure it out?
To pass along a technique which I recently learned on this list:
Define an event in your Valve class (i.e. failureNotice)
Have the valve class call that event when it fails
Implement that event in the instance of "Valve" residing in your
Engine class
When valve calls that event, Engine can respond appropriately to the
event
Roger M. Clary
Class One Software
http://www.classonesoftware.com
roger@classonesoftware.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|