package text03;
public class a {
public static void main(String[] args) {
Animal222 a=new Dog222();
a.name="非洲野狗";
a.age=15;
a.live="非洲大草原";
a.play();
}
public void Function(Animal222 a) {
a.play();
}
}
class Animal222{
String name;
int age;
String live;
void play() {
System.out.println(name+","+age+","+live);
}
}
class Dog222 extends Animal222{
void play() {
System.out.println("汪汪汪");
System.out.println(name+","+age+","+live);
}
void run() {
System.out.println("这狗在会跑");
}
}
class Cat222 extends Animal222{
void play() {
System.out.println("喵喵喵");
System.out.println(name+","+age+","+live);
}
void run() {
System.out.println("这只小猫在撒娇");
}
}