- +61 (414) 610-141
-
-Original Message-
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Jesse Liberty
Sent: Wednesday, 14 August 2002 9:02 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Copy constructor vs. ICloneable
Is there a good design
--Original Message-
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED]]On Behalf Of Bailey, Mark
> Sent: Wednesday, August 14, 2002 10:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Copy constructor vs. ICloneable
>
>
> hey, speaki
What's more, even if you do find what looks like a copy constructor, you've
not actually got any guarantees that it really is a copy constructor. For
example:
public class TreeNode {
public TreeNode(TreeNode parent) { ... }
...
}
If you were using reflection to look for copy constructors, t
l C# .NET", MS Press
- Original Message -
From: "Graeme Foster" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 14, 2002 6:36 AM
Subject: Re: [ADVANCED-DOTNET] Copy constructor vs. ICloneable
> I don't know what you'd call a good reason,
: Graeme Foster [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 14, 2002 9:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Copy constructor vs. ICloneable
I don't know what you'd call a good reason, but here's one that's good
enough for me - it's easier to cal
om: Moderated discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED]] On Behalf Of Jesse Liberty
> Sent: Wednesday, August 14, 2002 6:02 AM
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] Copy constructor vs. ICloneable
>
> Is there a good design reason to favo
I don't know what you'd call a good reason, but here's one that's good
enough for me - it's easier to call IClonable.Clone() than it is to call a
constructor for an unknown type.
Compare:
object clone = ((IClonable) anyObj).Clone();
To:
1. Get type of anyObj
2. Find copy constructor for that
Is there a good design reason to favor implementing ICloneable rather than
implementing a copy constructor?
-j
---
Jesse Liberty, President
Liberty Associates, Inc.
.NET Programming and Training
http://www.LibertyAssociates.com
You can read messages from the Advance