package com.pratice1;
public class Horse {
protected int leg = 0;
String name = null;
public Horse(int leg){
this.leg=4;
this.name = "马类";
System.out.println("马类的构造函数");
}
public String getName(){
return name;
}
}
package com.pratice1;
public class WhiteHorse extends Horse {
public WhiteHorse(int i){
super(i);
System.out.println("白马类的构造函数");
}
public static void main(String[] args){
WhiteHorse witheHorse = new WhiteHorse(4);
System.out.println(witheHorse.getName());
}
}