How to inherit Update?

So let’s say I have an Enemy and Player class both under the Mob class. In the Mob class, I have a function named CheckHealth, which checks to see if the mob is dead, but how do I avoid having to put CheckHealth in both the Player class and Enemy class Update methods? Can I somehow inherit the Update method from the Mob class?

You certainly can! I use it all the time. The Update() method is basically just a function name that unity recognizes and calls every frame (that is if the class it is a part of derives from Monobehavior).

To accomplish your desired functionality, you can do the following:

public class Mob : MonoBehaviour
{
    // The method name remains the same (Update), but the signature changes.
    // The 'protected' keyword to give derived classes access to this method.
    // The 'virtual' keyword informs derived classes that this method can be overriden
    protected virtual void Update()
    {
        checkHealth();
    }

    void checkHealth()
    {

    }
}

// Derived class
public class Player : Mob
{
    // Override the protected method that we delcared in Mob
    override protected void Update()
    {
        // Call the Update method in Mob
        base.Update();
    }
}

// Derived class
public class Enemy : Mob
{
    // Override the protected method that we delcared in Mob
    override protected void Update()
    {
        // Call the Update method in Mob
        base.Update();
    }
}