Introduction - If you have any usage issues, please Google them yourself
1), defines an abstract class Weapon, the abstract class has two abstract methods attack (), move (): These two methods represent the weapons attacks and moves.
(2), defines three classes: Tank, Flighter, WarShip are inherited from the Weapon, respectively, in different ways to achieve Weapon
Class abstract methods.
(3), write a class Army, on behalf of an army, this class has a property is an array of Weapon w (used to store all of the weapons owned by the armed forces) class provides a constructor in the constructor through the mass a parameter of type int to limit the class can have the maximum number of weapons, and to initialize the array with the size of the w. The class also provides a method addWeapon (Weapon wa), that represent the parameters wa added to the array w of weapons. In this class also defines two methods attackAll () and moveAll (), let w array and move all the weapons to attack.
(4), write a main method to test the above procedure.