i am trying to do chess with openGL c ++, for now i have created the pawn object, where its constructor takes an unsigned int parameter. So I tried to create an array of these pawns, and the only working way I've found to do this is this :
Pawn *pawn[n];
for (int i = 0; i < n; i++) {
    pawn[i] = new Pawn(Unsigned int var);
}
To call a function of pawn [0], for example, I have to do this :
pawn[0]->function(parameters);
This is the Pawn class :
class Pawn
{
private:
    float vertices [16] = {
        //position       //text coord
        -0.08f, -0.10f,   0.0f, 0.0f,
         0.08f, -0.10f,   1.0f, 0.0f,
         0.08f,  0.10f,   1.0f, 1.0f,
        -0.08f,  0.10f,   0.0f, 1.0f
    };
    GLuint indices[6] {
        0, 1, 2,
        0, 2, 3
    };
    unsigned int shaderID, VBO, VAO, EBO, texture;
public:
    glm::vec2 Position = glm::vec2(0.0f, 0.0f);
    Pawn () {}
    Pawn(GLuint shaderID) {
        ...
    }
    
    ~Pawn() {
         ...
    }
    void setTexture();
    void draw (glm::vec2 position);
};
I also tried this :
Pawn pawn[8];
for (int i = 0; i < 8; i++) {
    pawn[i] = Pawn(shaderID);
}
but when i run it doesn't work.
I was wondering if this method is efficient or not, and if so, why it works, since I didn't understand it. Thanks for your help
