Lecture overview -- Keyboard shortcut: 'u'  Previous page: Cloning -- Keyboard shortcut: 'p'  Next page: The fragile base class problem -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Abstract classes, Interfaces, and Patterns - slide 31 : 37

Cloning in C#

Internally, C# supports shallow cloning of every object.

Externally, it must be decided on a class-by-class basis if cloning is supported.

ICloneable.cs
A reproduction of the interface ICloneable.
Point.cs
A cloneable class Point.
Client.cs
A sample client of class Point.
Client-in-error.cs
Illegal cloning with MemberwiseClone.