Different variables for same class

Hi,

I want to create 7 objects of the same class but in each class, I need to have an array with a unique name for each object.

Is there a way to make this array?
Why do you want to do this? Isn't an integer with a unique value for each object sufficient as an ID?
Each object need to have an array with specific vertices.
Ok, I still don't see why the name of the array should vary among objects.
Isn't something like this good enough?

1
2
3
4
5
6
7
8
9
10
11
12
13
//#include <vector>

struct Vertex
{
    int x;
    int y;
};

struct MyClass
{
    Vertex vertices[10];
    //or std::vector<Vertex> vertices;
};
Ok..nvm I just was thinking that same name in diferent classes can interfere in calls in some libraries.

For example, a call to this function: http://www.opengl.org/sdk/docs/man/xhtml/glGenBuffers.xml
That's why we have class objects. So you can have lots and lots of them with the same names for all their internals and there can't be any confusion about which one you mean.
I'm not sure if I'm understanding you correctly but if I am I have this idea: It doesn't help you functionally at all, and is in fact counter to the main idea behind C++, but you could use typedef to rename the class objects.
Topic archived. No new replies allowed.