How do I get the sampleHeight for a terrain in the hierarchy?

I have several terrains in the hierarchy and layed out in my scene. I can get a reference to a specific terrain via

var curTerrain = GameObject.Find("Terrain "+curTileNumber);

and I'm trying to get the height above the terrain of my object using:

var heightOver = curTerrain.SampleHeight(transform.position));

but I get an error that SampleHeight is not a member of GameObject.

I kinda understand that, but don't now how I can reference the terrain to get the height.

As the docs say, SampleHeight is a member of Terrain, so you need to get the Terrain component.

var heightOver = curTerrain.GetComponent(Terrain).SampleHeight(transform.position);