我有这样一个层次结构:
public class A {
public abstract int hashCode();
}
public class B extends A {
public int hashCode(){
//I want this to return the object implementation of hash code
return 0;
}
}
我希望b.hashCode()返回Object实现的hashCode()。不幸的是,B必须扩展A,而A不能更改。
System.identityHashCode(this);
之外,还要参考有关“超级超级类”调用的已接受答案(如果您也想使用不同的方法来执行此操作):超级超级类方法调用 - Pandacoder