讨论一下 interface 的问题
一个类同时 implements 了两个 interface
可这两个 interface 里都有一个相同的函数(包括名称,参数)
在另一个类里生成这两个 interface 的实例
怎样分别定义和调用各 interface 里的函数?
例如:
//-------------------------------
public interface in1 {
public void type();
}
public interface in2 {
public void type();
}
// 两个 interface
//-------------------------------
public class test implements in1,in2{ //同时 implements 了两个 interface
public test() {
}
public void type(){ // 怎样分别定义?
System.out.println("type");
}
}
//------------------------------
public class test2 {
public test2 () {
}
public static void main(String[] args) {
Frame1 frame1 = new Frame1();
frame1.show();
in1 tes1 = new test();
tes1.type(); // println("type")
in2 tes2 = new test();
tes2.type(); // println("type")
}
}