如果我说
class A{
}
然后它隐式继承 Object 类。所以我的类如下:
class A{
protected Object clone(){
} /// Here i am not overridning
//All the other methods (toString/wait/notify/notifyAll/getClass)
}
现在为什么我不能访问 Class B 中的 clone() 方法,该方法在 Class A 的同一个包中。
Class B{
A a = new A();
a.clone();
**
}
//** 说克隆在对象类中受到保护。但是我没有访问 Object 的 clone 方法。无论如何,我在这里调用 A 类的 clone 方法,但我还没有重载。