Cannot implicitely convert type 'CameraMove' to UnityEngine.Camera

I have public Camera cam;

And then

Start () {
cam = Camera.main.GetComponent<CameraMove>();
}

But it gives the error:

Cannot implicitely convert type 'CameraMove' to UnityEngine.Camera

Any ideas for this? Thanks

You’re trying to assign something with a CameraMove data type to a variable that’s a Camera data type.

Declare your cam variable as CameraMove.

CameraMove cam;
cam = Camera.main.GetComponent<CameraMove>();