为什么输出没问题,却提示使用super()和 Ruble 必须返回"RUB"
package zh.codegym.task.task14.task1417;
import java.util.ArrayList;
import java.util.List;
/*
货币
*/
public class Solution {
public static void main(String[] args) {
Person paul = new Person("保罗");
for (Money money : paul.getAllMoney()) {
System.out.println(paul.name + " 储备了 " + money.getAmount() + " " + money.getCurrencyName());
}
}
static class Person {
public String name;
private List<Money> allMoney;
Person(String name) {
this.name = name;
this.allMoney = new ArrayList<Money>();
allMoney.add(new Euro());
allMoney.add(new Ruble());
allMoney.add( new USD());
}
public List<Money> getAllMoney() {
return allMoney;
}
}
}