I am working on a project in which I have a number of cables
that are connected/disconnected. Because the code for toggling the
states is used so much, I created a simple class to perform the
task of unplugging/reconnecting the cables. In this class, I have a
function called cableClick that simply toggles the state of the
cable between the 2 states.
Now, however, I have some cables which the user needs to
perform voltage tests on. In those cases, the cables has a third
frame which we name "face". When in this face frame, the user can
place a multimeter probe on any of the pins of the cable.
So, in order to code this, I figured I would create a
subclass of cableClass (I called it voltageCbl). In this class, I
added a new function called placeProbe which will place the
multimeter probe over the correct pin. I also created another
function called resynchProbes which will simply place the probes
back in the appropriate places if the user leaves the scene before
removing the probes and returns.
The question I have is... How do I call the placeProbe
function? I don't think I'd want to create a new cableClick
function if it is going to have nearly the same code as that in the
cableClass. But then again, the cableClass doesn't know anything
about the placeProbe function.