Dear reader,
I noticed that I'm often in the need of a container class. For example when working on a particle system, I create a container class Particles
which has a member vector<Particle*>
. Then I call: Particles* my_particles
like my_particles->draw()
, and in the Particles.draw()
I iterator over the vector<Particle*>
and call draw()
on each of the particles again. The same works for member functions like update()
, addforce()
etc.. Now, I'm working on a project and need a collection of Cube
on which I need to call tween()
, moveTowards()
etc..
I know I can use template, but in the case of a template class the member functions need to be knows before. As I want to check if I can make a generic class, that I can use for example both my Cubes and Particles collections.
Someone who has done this before or can give me some advice on this?
Kind regards, Pollux