my dizzyCreature class inherits from both a creature class and a dizzy class. It is also part of a polymorphic collection of creature classes. If I know that my object in the creature class is a dizzyCreature, is there a way to call a function from the dizzy class?
I have tried
creature[2].dizzyCreature::someFunction();
and
dizzyCreature::creature[2].someFunction();
and neither works. Any ideas?
If I understand correctly what you have is something like this:
list<Creature*>. This list contains somedizzyCreatureinstances. On those instances you want to call methods ofdizzyclass. If this is the objective then you can usedynamic_castto achieve this. Lets say you haveCreate* pCreaturethen you can do: