Initializing vertex array

Ok, so I’ve got two derived classes from a Shape base class. The base class contains the vertices, normals and indices that I want to use with glDrawElements(). I want to initialize the fields with the values given in the constructors of the derived classes. What is the best way to do this? The only thing I can come up with is

Cube() : vertices({blablabla}){}

But at this time, the field is already initialized by the default Shape() constructor, right?

This might be a pure C+±related question but I got great answers on my last post so I thought I might as well ask.

no matter what is initialized till that point you can do anything you want in the derived class ctor() scope. Cube::Cube(){ /* init */ }

This might be a pure C+±related question but I got great answers on my last post so I thought I might as well ask.

You got answers the last time because you are new to this forum. So now you know it is an OpenGL only forum, ask on a more general one. or at least read a good C++ lesson.

And to answer you c++ question (I hope for the last time). If Cube inherits from Shape, the Cube constructor will call the Shape default one if you don’t explicitly call it, like:

Cube : Shape(…)
{

}

If there are not default constructor in Shape you have to call it explicitly or create one.

Then you can pass vertices data to your Cube instance that will then call the Shape constructor to initialize its members.