Haven’t used inheritance much before so I’m confused by the following C# scenario:
Parent object has method:
void OnTriggerEnter() {
MyFunction();
}
void MyFunction() {
DoSomething;
}
Child object has method:
voi MyFunction() {
DoAnotherThing;
}
But the child’s MyFunction never gets called! The parent’s MyFunction is called instead on trigger enter. I though a child’s functions were supposed to override the parent’s? Am I missing a qualifier of some kind, like “protected”, or “extends”?
You may also need to change the protection level (i.e. private, protected, or public) of the functions.
As for the reasoning, your best bet would probably be to Google/search for ‘c# polymorphism’ (you should be able to find some good references on the topic).
Sorry for the brevity, I had just returned home at 20 before midnight and was a little tired and wanted to point you in the right direction. Trust me, at that point it would have been a rambling mess of an answer, probably with a dirty joke thrown in there.