I need a virtual function so I can override it with sub-class methods.
Sure I worked around the problem, that's good enough
It was because I had that constructor call to it's super class inside the sub class' constructor, it mucked up the class in some way (almost turning it into the superclass class...).
I guess that the definition that you showed earlier...
CSubClass :: CSubClass () : CSuperClass()
{
...
}
was a better way of doing it but I haven't tried that since I'd rather stick to my current method... but whenever I need to do this again, I'll try it like that
The normal code is just a list of bot commands, a list of "CBotCvar"'s (which is the super class) and each subclass is a unique command... e.g. bot_menu (shown earlier). It has it's own action() function which does its stuff.
The super classes action method is virtual and it does nothing. So that when I look through the list and call the bot_menu "CBotCvar" action() method, it should call CBotMenuCommand's action() to do its business.
I need the action function in the superclass so I can compile it! And I need it to be virtual so that it will call the appropriate action() method of the subclass if I wrote one for the subclass.