close
p7-20
類別可以實作兩個以上的介面
For Example
interface student{
void study();
void discuss();
}
interface teacher{
void teach();
void discuss();
}
若是discuss()做的內容都相同,可以設定一個父介面描述這個method
============== Better Method ===============
interface Action{
void discuss();
}
interface student extends Action {
void study();
}
interfeace teacher extends Action {
void teach();
}
全站熱搜