/** If there exists no other particle sharing the input position, creates a new ThingB particle in the heap and adds a pointer directed to it in the things vector of the Board @param pos is the int position value for the new ThingB object @param prop is the double property for the new ThingB object @return a bool value: true if ThingB object can be added and false otherwise */ bool AddBParticle(int pos, double prop) { //if no particle is at position pos, then add, otherwise don't add if (!ParticleInPosition(pos)) { ThingB* thing = new ThingB(pos, prop, *this); things.push_back(thing); return true; } return false; }
/** Checks whether or not there is an element in the specified position using the ParticleInPosition function @returns the result of the ParticleInPosition function */ bool operator[](int pos){ return ParticleInPosition(pos); };