![](/img/trans.png)
[英]How to create instance of a class which is created using guice factory assisted inject and is extended from an abstract class?
[英]How to clone an object which is extended from an abstract class?
我认为调用“ super.clone()”不是去Cloneable类,而是去抽象类。
public class Mainprogramm {
Test original = new Test();
Test copy = original.getClone();
}
public class Test extends AbstractClass implements Cloneable{
public Test getClone(){
try
{
return (Test) super.clone();
}
catch(CloneNotSupportedException a)
{
return this;
}
}
}
public class AbstractClass implements Cloneable{
//no abstract clone-method...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.