Foo copyFoo (Foo foo){ Foo f = new Foo(); //for all properties in FOo f.set(foo.get()); return f; }
Foo actual = new Foo("foo"); // 1 // 2 Foo formal = actual; // 3 formal.set("bar"); // 4 // 5 actual.get(); // returns "bar" // 6
Foo actual = new Foo("foo"); // 1 // 2 Foo formal = actual; // 3 formal = new Foo("bar"); // 4 // 5 actual.get(); // returns "foo" // 6