Particle effect system structure

view full story

http://www.daniweb.com – I'm creating a particle effect system in C++ with SDL. I'm coding a hiarcharchy like this one (scroll a bit down and you will see it). I have an abstract base class called Particle. It's abstract because I want the derived classes to be forced to implement the pure virtuals (like the Update member function). Two classes derive from this: ExplosionParticle and TailParticle. The explosion effect needs to known where to explode (x, y) and does not need to reset its particles when they die out. The tail effect needs to know which object it is attached to and needs to reset position, velocity etc. in relation to this attached object when it dies out. The problem is how to call a Reset function from the ParticleEffect class for my TailParticles.. Something like this: Particles[i]->Reset(attachedTo); 1. If I declare Reset a pure virtual ExplosionParticle, which does not need it, is forced to override it. 2. Declaring Reset as a unique function wont work either since the system relies on polymorphism. 3. Finally, I could declare the it as a normal virtual member function and just not override it in the ExplosionParticle class. The 3rd option seems to be the best so far, yet I would like a more elegant solution if possible. I'm also willing to redo my design. As a final note I'm wondering whether I should let my ParticleEffect class update all the particles by setting their vaules directly (so basically, the Particle class is public and has no functions) or I should have it call each particle's Update member function... (General)