1 abstract class Prototype 2 { 3 private string id; 4 5 // Constructor 6 public Prototype(string id) 7 { 8 this.id = id; 9 } 10 11 // Property 12 public string Id 13 { 14 get{ return id; } 15 } 16 17 public abstract Prototype Clone(); 18 }
// "ConcretePrototype1" class ConcretePrototype1 : Prototype { // Constructor public ConcretePrototype1(string id) : base(id) { } public override Prototype Clone() { // Shallow copy return (Prototype)this.MemberwiseClone(); } }