The Artima Developer Community
Sponsored Link

Canonical Object Constructors

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Canonical Object Constructors

Posted by Reginald Braithwaite-Lee on 08 Oct 1998, 7:17 AM

I believe that all classes should support a copy constructor:

public void someMethod (Foo fIsaFoo) {
Foo barIsAnotherFoo = new Foo(fIsaFoo);
....
}

At the very least, a constructor with the signature:

public Foo (Foo fooToCopy);

should clone the argument supplied.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us