子类也必须遵守第一条和第二条规则。它从超类Cat继承了标识属性。
Cat
package eg; public class DomesticCat extends Cat { private String name; public String getName() { return name; } protected void setName(String name) { this.name=name; } }
Submit feedback about this site to: