- Home /
Overriding a function.
So I have a controller class which has a getter for the character's view. But I have a player subclass that should instead get the camera's view from the same function.
Basically, I want to call GetView on any controller, but get the player's camera when called on a player.
How would I go about this?
Answer by paulaceccon · Aug 03, 2013 at 04:57 PM
I don't know if your problem is so simple, but what I imagine is that you need to declare the controller class as abstract, implement the standard get function, declared as "virtual", and just override it in your player subclass.
Check the second code example here:
http://msdn.microsoft.com/en-us/library/ebca9ah3(v=vs.80).aspx
It is not necessary to make the parent class abstract, although it is good program$$anonymous$$g practice if that class should never be instantiated.