Print

Print


On Aug 18, 2005, at 4:11 PM, Michael Makowsky wrote:

> It would appear that we want to a create a collection of particles,
> but in
> fact we keep creating a single instance of the particle class (or at
> least
> multiple objects with the same reference "p." If we wanted to have the
> particles interact with each other (bounce off of each other), how
> could we
> differentiate between the particle objects, since they all have the
> same
> reference?

'p' is a *reference* (or pointer) to the particle.  It's a box which
holds the particle's address.  Its function is to schedule the object
and then place it into the grid.  Once that's done, we just reuse the
box for another particle's address.

Sean