How to get a specific object of the same type?

Hi,
i dont know what exactly to search for, so i’ll better ask you.

Lets say i have a class that defines a hero in a game.
And you can create two or three of the same.

Then i would write something like this:

public class Hero
{
public string _name;
public int _strength;

public void attack();
}

Now i would make an instance of a Hero and access the variables from it right?
Something like this:

Hero myHero = new Hero();
myHero.name = "Bruce";
myHero.attack();

The data for the hero will be saved in an object.
If i create another hero the first one will be overwritten. Because the instance would be the same.

What would you suggest to do to differenciate between two or more objects of the same type?

Think on some game like Diablo, where you can create more then one heros of the same type.

Hope you understand my problem.

Greetings, Michael

So, rather than having a single Hero variable, you have an array of Heroes:

Hero[] myHeroes = new Hero[4];

Then, loop through the array to access each hero individually.

I would just number them
myHero01
myHero02
myHero03
and so forth. Have those numbers refer to the order they were created in.