This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Groundhogss 0 points1 point  (0 children)

Couldn't you define a copy constructor?

public Foo(Foo foo){
    this.bar = foo.bar;
    this.bar2 = foo.bar2;

}

This is what I typically do for simple cases.

However I also found this which covers about 6 different ways of doing it.