日期:2014-05-20  浏览次数:20687 次

一道我的考研题
Using   the   example   of   "Payroll   System   Using   Polymorphism "   to   create   the   example   of   Animal,   Dog,   and   Cat   by   using   Polymorphism,   and   to   use   one   loop   to   make   the   cat   and   dog   "Jiao "   one   time!

------解决方案--------------------
多态嘛,animal是父类,有一个方法jiao(),cat dog继承animal,然后循环调用父类的jiao()
------解决方案--------------------
java中没有多重继承,只有接口可以变相的实现,
public interfece Animal{}
public class dog extends Animal{}
public class cat extend Animal{}