Information about Classes and Instantiate Objects C#

Hi to all Unity Experts, I was wondering how can I instantiate Objects from Classes.
and before I start sorry for my Bad English.

well here we go
I’m trying to create a class named “Enemies”
this is the class Enemies

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour {

private int hpEnemy;

public int _hpEnemy
	{

		get { return hpEnemy; }
		set { hpEnemy = value; }

	}

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

yeah I know there’s no sense mistakes lol, but I’m trying to studing C# and Unity al by myself.

and when I try to open another Script Often in Visual Studio C# i do this

Enemies myFirstEnemy = new Enemies();         // <---Instantiate an Object
myFirstEnemy._hpEnemy;                              //  <-----Calling the propriety

but the problem is that in Unity when I try to Instantiate the Object, it doesn’t give me the proprieties like above :\

I would like to know why it doesn’t work, I want an explaination :frowning:

Again Sorry for my Bad English.

First you can not call new on a MonoBehaviour. A MonoBehaviour must be added to a GameObject. You either directly add it to a GameObject in the inspector or you must do it by calling GetComponent(); in script. So you could do something like this

public Enemies enemies;

void Start()
{
    // was a enemies property set in the inspector?
    if (enemies == null)
    {
        // no - so lets add one to the Current GameObject
        enemies = GetComponent<Enemies>();
    }
    enemies._hpEnemy = 0;
}

by the way I forgot to mention i’m trying to make OOP Encapsulation.