Polymorphism?

i think that’s what my problem is anyway…

i have a MidiLearn class, which has a member function SetTarget(MidiLearnTarget* target)

this is used to set a target for a given input midi message.

i inherit the MidiLearnTarget class into any component i want to use as a learn target; it just consists of a pure virtual function respond(uint8 value) which carries out whatever action is required for it; if a message is recieved by the MidiLearn class that is in its learn tables, it will look up the target pointer and call respond().

now, this midiLearn class sits in the main component. my test target component class TestMLSlider inherits Slider and MidiLearnTarget, and overrides respond() to set the slider value from the message value.

if i call learner.setTarget(TestMLSlider* ) then it works fine, but if it is called with a MidiLearnTarget* it doesn’t do anything. the learner’s functions for checking that it has a target works (it only stores an entry if a target is set and it is armed to learn), so it’s obviously getting a target pointer, but respond() doesn’t do anything.

this is really annoying me because i want to be able to send a message to the learner straight from the target component to set the target; i can’t make the learner add a TestMLSlider* type pointer because it’s not supposed to know all the types, and should be able to respond just by having a base class pointer…

anyone have any ideas? perhaps i should post my code and you can have a look at it