我在java
以下分級來我interface
在斯卡拉
public interface Identifiable<T extends Comparable<T>> extends Serializable {
public T getId();
}
public interface Function extends Identifiable {
public String getId();
}
public abstract class Adapter implements Function {
public abstract String getId();
}
當我嘗試在scala
實現Adapter
如下
class MultiGetFunction extends Adapter {
def getId() : String = this.getClass.getName
}
我收到以下錯誤
實現多級的Java接口Multiple markers at this line
- overriding method getId in trait Identifiable of type()T; method getId has incompatible
type
- overrides Adapter.getId
- implements Function.getId
- implements Identifiable.getId
http://stackoverflow.com/q/5279149/1296806其中包括一個經典的paulp迴應。 –