日期:2014-05-20 浏览次数:20840 次
package p1;
public interface SayMe {
void say();
}
package p2;
import p1.SayMe;
public class Person {
protected class PersonSayMe implements SayMe{
public void say(){
System.out.println("PersonSayMe");
}
}
protected void walk(){
System.out.println("Person walk");
}
}
package p3;
import p2.Person;
import p1.SayMe;
public class FeMale extends Person{
public SayMe getSayMe(){
return new PersonSayMe(); //为什么这个不能继承Person 的 PersonSayMe ????
}
public static void main(String[] args){
new FeMale().walk();
}
}
public class FeMale extends Person{
public SayMe getSayMe(){
return new FeMale().new PersonSayMe(); //为什么这个不能继承Person 的 PersonSayMe ????
}
public static void main(String[] args){
new FeMale().walk();
}
}