[JAVA] ch07-18. 객체 지향 18
·
JAVA/예제
public class Ex18 { public static void main(String[] args){ Yoker yoker = new Yoker(); Tablet tablet = new Tablet(); PC pc = new PC(); Audio audio = new Audio(); yoker.buy(tablet); yoker.buy(pc); yoker.buy(audio); yoker.summary(); } } class Audio extends Product{ Audio(){ super(50); } public String toString(){ return "Audio"; } } class Yoker{ int money = 1000; int bonus = 0; Product[] item = new..