i'm pretty sure i know the answer, but i just wanted to be sure.
ap = new NonmovingObj(animPtr, new Disk(20, Green), 0, 0);
ap->update();
Disk is NOT a subclass of NonmovingObj.
both classes, NonmovingObj, and Disk have a function called update(). does the second line (through dynamic dispatching) call NonmovingObj's or Disk's update function?
i think it's Disk's but i'm not sure.
ap = new NonmovingObj(animPtr, new Disk(20, Green), 0, 0);
ap->update();
Disk is NOT a subclass of NonmovingObj.
both classes, NonmovingObj, and Disk have a function called update(). does the second line (through dynamic dispatching) call NonmovingObj's or Disk's update function?
i think it's Disk's but i'm not sure.
