"It depends". Not all classes have copy constructors. Some classes define clone() , while others inherit it from Object .
If you are thinking about how to implement copy semantics in your class, many recommend against cloning, but others recommend it. A third alternative is the static factory method, which does the job.
If you are trying to make a copy of an existing class, you are at the mercy of the existing implementation. Maybe it has clone() , which does what you want, and maybe not. Maybe he has a copy constructor, maybe not.
source share