From: Vince Morgan on 15 Feb 2006 01:02 "Ulrich Eckhardt" <doomster(a)knuut.de> wrote in message news:450563F48kggU1(a)uni-berlin.de... > > Although most calls are objects of the base type, there are others of the > > derived type. > > So as you can see above I have cast the base type objects to the derived > > type in the callback. (correct cast?). > > This is working fine, but I have come to realize I hadn't planned for > > this, and that there may be a more appropriate method that deals with > > possible future changes such as additional parent classes. > > This should be almost fine. You don't tell us about it, but On_Callback() > is probably a virtual function defined in the baseclass. So, there is no > need to cast to HoverTextButton, casting to the baseclass HoverButton > should be enough, while the virtual dispatch does the rest. > I've slightly restructured the classes to use virtual dispatch, and it's working fine. Thank you again Uli > Uli > > -- > FAQ: http://ma.rtij.nl/acllc-c++.FAQ.html |