Nearly all classes lack the capability of copying. There are two options:
- Use copy constructors.
- Advantage: Type-safe, no castings needed
clone():
- Advantages: Java conform, works together with other components. Especially every
Object has a clone-function.
- (big) Disadvantage: Annoying implementation, involves many casts and a try-catch. Not really efficient.
Nearly all classes lack the capability of copying. There are two options:
clone():Objecthas aclone-function.