If I wanted to access a function that is in a derived class from it's base class, what would be the best way of doing so? I have experimented with functions like Interact( char *pCommand, char **pArgs ) which is inside the base class, and can be overidden by the derived class to access it's functions. But that doesn't really seem like the best way to do so. Can someone give me a suggestion or two as to what the best way to do this is. If you need a better explanation of what I'm trying to do, just ask.

7 Years
Discussion Span
Last Post by jwenting

The base class knows nothing about the existence of child classes, and should never even want to know.
If you think you have such a requirement, you have a fundamentally flawed design.

But most likely all you need are some virtual functions, which would make the whole thing happen implicitly, so the correct overridden function from a child class gets called from a non-overridden method in the base class when that method is used from an instance of that child class.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.