面向对象编程思想
-
-
简化参数传递.
-
让代码有层次结构.
-
-
public class Goods { private String name; private String type; private String brand; private float price; } public class Pear extends Goods { } public Consumer { public void buy(Goods goods) { System.out.println("购物啦"); } }