Friday, May 21, 2004 3:24 PM Shawn A. Van Ness

Copy Constructors vs ICloneable -- Redux

Back in 2002, I wrote an article for ONDotNet.com, about .NET's copying, cloning, and marshalling semantics.  I suggested that the role of C++ style copy constructors was diminished, in the face of ICloneable.  Boy, was I wrong...

http://www.windojitsu.com/blog/copyctorvsicloneable.html

Comments

# re: Copy Constructors vs ICloneable -- Redux

Sunday, May 23, 2004 11:06 AM by Frank Hileman

Yes, I agree, there is no other logical approach for cloning, than a copy constructor. The difference in C# is that you might want to keep the copy constructor protected, instead of public. It just makes the API a little cleaner to leave those out of the public interface.

Another nice thing to have is strongly typed Clone methods -- leave ICloneable as an explicit interface implementation.

# re: Copy Constructors vs ICloneable -- Redux

Monday, May 24, 2004 4:14 AM by Frans Bouma

You can see the truth of this article when looking at how to clone a class derived from TreeNode or Hashtable. Both base classes implement ICloneable, but this is useless for the derived class....

# Implementing ICloneable

Monday, May 24, 2004 6:43 AM by TrackBack

# re: Copy Constructors vs ICloneable -- Redux

Wednesday, July 14, 2004 7:51 PM by 小说

I also think that software development is still hard.