- Home /
This question was
closed Jul 15, 2012 at 09:44 PM by
whydoidoit for the following reason:
Duplicate Question
Question by
yveris · Jul 15, 2012 at 12:05 AM ·
updateinheritancevirtualoverride
Using inheritance does base.Update() call overriden functions?
What I mean to say is: When a superclass contains a shoot(params...) method and an update() that calls the shoot() method.
And a subclass contains an overriden shoot(params...) method.
If said subclass calls base.Update() does it use the base shoot()?
As I want it to call the overriden shoot as I created an update function in the superclass, that all the subclassses will pretty much use, just with different overriden shoot functions.
Comment
Answer by whydoidoit · Jul 15, 2012 at 12:06 AM
No it will call the overridden shoot. Just a note, you should declare Update as virtual in the base class.