Writted by Bruth_Lee in Southwest University of Science And Technology.
This database is mainly to modify the last code, using the code that repeats the inheritance and polymorphism.
这次的数据库主要是对上次的代码进行修改,利用继承与多态改进重复的代码!!
There are some classes as follow.
Test:
package GAME;
import java.util.ArrayList;
public class Test {
ArrayList<item> listitem = new ArrayList<item>();
public void add(item item1) {
listitem.add(item1);
}
public void list() {
for(item item1 : listitem) {
// ((Gameplayer) item).print();
item1.print();
}
}
// private void print() {
// // TODO Auto-generated method stub
//
// }
publi