Answer the question
In order to leave comments, you need to log in
Why invent clone() when you can use the copy constructor?
I do not quite understand why clone is needed to copy an object, if it's faster to use just a copy constructor. Clone also needs to override the method and implement Clonable, when everything in the constructor is two times. I read various articles about object cloning, but I did not find a normal answer to this question. Can someone explain why we need a separate clone method if a copy constructor is available and which of these two methods is better and more relevant in 22?)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question