?? diamondinheritance13.java
字號:
// interfaces/DiamondInheritance13.java
// TIJ4 Chapter Interfaces, Exercise 13, page 328
/* Create an interface, and inherit two new interfaces from that
* interface. Multiply inherit a third interface from the second
* two.
*/
interface CanDo {
void doIt();
}
interface CanDoMore extends CanDo {
void doMore();
}
interface CanDoFaster extends CanDo {
void doFaster();
}
interface CanDoMost extends CanDoMore, CanDoFaster {
void doMost();
}
class Doer implements CanDoMost {
public void doIt() {}
public void doMore() {}
public void doFaster() {}
public void doMost() {}
}
public class DiamondInheritance13 {
public static void main(String[] args) {
Doer d = new Doer();
((CanDoMore)d).doMore();
((CanDoFaster)d).doFaster();
((CanDo)d).doIt();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -