agent6262
Member, Male
- agent6262 was last seen:
- Aug 6, 2015
- Loading...
- Loading...
-
About
- Gender:
- Male
Interact
Signature
You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage method on theFoot , so the Foot can damage itself in the most effective way. Now you run the program, and call the doShootmethod on the instance of the Gun class. First the Gun creates an instance of Bullet , which calls the doFire method on the Gun . The Gun calls thehit(Bullet) method on theFoot , and the instance of Bullet is passed to theFoot . But this causes an IllegalHitByBulletexception to be thrown, and you die