error CS1061: Type `UnityEngine.Component' does not contain a definition for `AddForce' and no extension method `AddForce' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?

I am new to unity and while learning i just copy code from tutorials page gives me error.
[Detecting Mouse Clicks - Unity Learn][2]

accessing rigidBody in this way is now deprecated and should not be used, it is also represented as its base type “Component” and as such does not have all of the features of RigidBody type unless you cast it.

However since it is deprecated I suggest using the GetComponent approach instead.

    void OnMouseDown()
        Rigidbody lRigid = GetComponent<Rigidbody>();
        if (lRigid != null)
            lRigid.AddForce(-transform.forward * 500f);
            lRigid.useGravity = true;