Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy constructors or clone()? #20

Open
Makman2 opened this issue Apr 29, 2015 · 0 comments
Open

Copy constructors or clone()? #20

Makman2 opened this issue Apr 29, 2015 · 0 comments

Comments

@Makman2
Copy link
Owner

Makman2 commented Apr 29, 2015

Nearly all classes lack the capability of copying. There are two options:

  1. Use copy constructors.
    • Advantage: Type-safe, no castings needed
  2. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant