How can Unity framework recognize the functions defined in child objects?

Hi,

I was trying to develop a C# framework for Unity and got a question which seems to be more relevant to OOP.

In Unity, with objects derived from MonoBehaviour, we have functions like: Update(), Start(), Awake(), OnTriggerEnter(Collider obj)... in which we can define logic implementation to relevant events. We also can leave those functions blank if we don't want to override.

Normally, for injecting logic implementation defined by in child objects, I mark the method as "virtual" or "abstract" and then "override" it later.

class ParentObject
{
    protected void ALargeFunction()
    {
        // Do something

        // An event fires here. Implement logic defined by child object.
        ChildLogicImplemtation();

        // Do other things
    }

    protected virtual void ChildLogicImplemtation()
    {
        // May put some Default implementations here.
    }
}

class ChildObject
{
    protected override void ChildLogicImplemtation()
    {
        // base.ChildLogicImplemtation();
        // Extension...
    }
}

Is there anyway that I can make my code like what we have in Unity? Something like this?

class ChildObject
{
    // - Don't have to use 'override' keyword here
    // - Can ignore this function if not necessary.
    void ChildLogicImplemtation()
    {
        // Extension...
    }
}

How can Unity framework recognize the functions defined in child objects?

Thanks in advance,

Viet.

They're found via reflection, and added to delegates (or something similar - either way it's storing a pointer to the function somewhere). Then, if they exist, they're called when necessary

It makes things a lot faster than using virtual/override functions, as it doesn't need to go from the native engine to the script code when it's not implemented