Initializing an array of classes

Hi, I am trying to create a particle engine. This class ParticleEngine contains a pointer to a specified number of particles, then it will go through and doo all of the math to initialize them. I am trying to create a new array of particles like
 
Particles = new Particle[AmountOfParticles];

The problem is that the class Particle does not have a constructor with no parameters (it is actually Particle(float, Color&,Mass*)) So how would i make all of the particles?
http://www.cplusplus.com/forum/general/18926/

That thread indicates that you'll have to provide a default and then loop though again to initialise.
Last edited on
closed account (1yR4jE8b)
You could use "placement new" and allocate the memory, and then loop over the array to initialize them.

http://en.wikipedia.org/wiki/Placement_syntax
Topic archived. No new replies allowed.