How can I listen for a function being called from a parent class?

Just for simplicity of getting my question across, let’s say I have this:

public class Humanoid : MonoBehavior
{
    void Die()
    {
    //Do stuff
    }
}

If I have a child class, how can I accomplish a “listen” for the Die() function, like if I want something specific to happen to the child on Die() that does not happen to the parent, like this:

public class Orc : Humanoid
{
    void OnDie()
    {
    //Do stuff unique to orcs whenever the parent class calls its Die() function
    }
}

How can I accomplish this? Thanks.

It’s quite simple, actually. Use the virtual keyword on the base class, and the override keyword on the derived class.

public class Humanoid : MonoBehavior
{
    protected virtual void Die()
    {
    //Do stuff
    }
}

public class Orc : Humanoid
{
    protected override void Die()
    {
    // do stuff here if you want it done before the stuff in the base class
    base.Die();
    // do stuff here if you want it done after the stuff in the base class
    }
}