Skip to content

Instantly share code, notes, and snippets.

@shahin-dev
Created June 17, 2014 14:16
Show Gist options
  • Save shahin-dev/8aa6da9f913994ae66cd to your computer and use it in GitHub Desktop.
Save shahin-dev/8aa6da9f913994ae66cd to your computer and use it in GitHub Desktop.
Patterns.Prototype
namespace Patterns.Prototype
{
abstract class Chips
{
private string id;
public Chips(string id)
{
this.id = id;
}
public string Id
{
get { return id; }
}
public abstract Chips Clone();
}
class ChipsPowerups: Chips
{
public ChipsPowerups(string id) : base(id) { }
public override Chips Clone()
{
return (Chips)this.MemberwiseClone();
}
}
internal class Program
{
private static void Main()
{
Chips p1 = new ChipsPowerups("1");
ChipsPowerups c1 = (ChipsPowerups)p1.Clone();
Console.WriteLine("Chips: {0} ", c1.Id);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment