No. The overridden virtual function cannot have a different signature from the function it overrides. It would be impossible to call.
Think about it:
1 2 3 4 5 6 7
A* a = new B;
a->DoSomething( "foo" ); // error, A::DoSomething doesn't take a string
// remember that at this point, a may or may not point to a B object. It might point
// to an A or some other type derived from A.
a->DoSomething(); // works, but now you don't have a string passed
Yeah but I do not need a common interface for my classes. My structure is as follows:
HumanController and AIController
both inherit from Controller
which inherits from Object.
Each needs an update function. The Object class knows nothing about what its updating and the Controller class doesn't know enough about its type to update. However the HumanController needs an array of boolen key info whereas the AIController needs an array of AINodeInfo for path finding.
I could make a function in Object as follows:
virtualvoid Update(bool keys, AINodeInfo** ai);
But then that type specific information is being passed to instances that have no need for it.
Is there a way to do what I need or is my structure flawed?
Yeah but I do not need a common interface for my classes.
If you do not need a common interface, then why use virtual functions at all? Providing common interfaces is exactly what they're for.
The real question here is this: Does the code calling update know enough about the object to pass it the keys or the ai?
If it does, then you don't need virtual functions, and Update() can be a normal non-virtual member of HumanController and AIController.
If it does not, then you'll have to provide a common interface that's generic enough to work with both classes.
In the case of the latter, you can probably pass in the keys/ai in a separate (nonvirtual) function, then have a general virtual Update() function that takes 0 parameters. (though this probably is not a great solution)