# C++ Multiple Classes

**URL:** https://forum.kirupa.com/t/c-multiple-classes/323550
**Category:** programming
**Created:** [July 6, 2011, 2:03pm UTC](https://forum.kirupa.com/t/c-multiple-classes/323550 "2011-07-06T14:03:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gunstar\_Hero](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@Gunstar\_Hero](https://forum.kirupa.com/u/Gunstar_Hero)
#### Post date: [July 6, 2011, 2:03pm UTC](https://forum.kirupa.com/t/c-multiple-classes/323550/1 "2011-07-06T14:03:59Z")

</div>

Alright, so I’m working on a game, and I’m actually doing pretty good for my first C++ project (was entangled in the much more visual flash/ as3, but the speed of C++ and openGl are awesome :D)

Out of everything crazy and broken that I’ve typed in this mess of text I call love, I need some help on something more basic.

I need to create multiple instances of classes like:

```auto

//Simple for statement
for(int i=0;i<500;i++){
 //Declare an "enemy_sniperJoe with the name enemy_sniperJoe with a number.
 enemy_sniperJoe enemy_sniperJoe //with i at the end, Don't know how to do this.
}
//end

```

I’ve heard that this is not the way to go. I think I’m supposed to store the classes in a vector and track them their.  
like:

```auto

for(int i=0;i<500;i++){
 //Declare an "enemy_sniperJoe with the name enemy_sniperJoe with a number.
 enemy_sniperJoe enemy_sniperJoe //wouldn't this keep repeating the same class and break?
 //Add this to a vector, don't know how to.
}

```

So, how should I go about this, how do I keep the class instances from being the same if I use the container method, and could someone just tell me what vectors are compared to arrays or something similar?

And yes, it is a Megaman Engine (sniperJoe is a dead giveaway :P)
