Hi folks,
Thanks to previous threads on this list, I'm making pretty good progress on
what is my first OOP project. The improvements I've made after feedback are:
* logical bounderies between containers and contents (sub-classes)
* nicer interface functions
* (starting to use) named parameters, with option to still use positional
* Classes only know about themselves and sub-classes
I now have the following structure (roughly). Trainset is the top level class
and is the container for everything .
Program
|->Trainset (everything)
|-> Box ( individual signalbox)
|->Gantry ( signal gantry)
| |->Signal
|->Tcb (Length of Track Circuit)
| |->Track (single length of track)
|->Lever (lever in signalbox)
One of the points made in the previous threads was that there should be no
need for sub-classes to have a link back to it's parent, and through the
correct splitting of functions (inter-instance in class, intra-instance
within container) I've done this okay.
My problem is now:
I need to be able to pass to the Trainset instance a ref to a callback within
Program (to refresh a PerlTk window, or to send a signal to a model railway
controller). This callback then needs to be triggered by the Trainset
instance itself, but also from Signals, Gantries, and Tcbs.
Other than going back to holding a ref to the Trainset instance, or worse
still, copying the ref to the callback to every object, how can I do this?
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>