package com.javacongrumendaojingtong.chapter10;
class Test {
public Test(){
}
protected void doSomething(){
}
protected Test dolt(){
return new Test();
}
}
class Test2 extends Test{
public Test2(){
super();
super.doSomething();
}
public void doSomethingnew(){
}
public void doSometing(){
}
protected Test2 dolt(){
return new Test2();
}
}
protected,重寫出來還是protected,不能是public。按照OOP的觀點(裡氏替換原則),派生類不能改變基類的接口形式。