Created
June 17, 2014 14:16
-
-
Save shahin-dev/8aa6da9f913994ae66cd to your computer and use it in GitHub Desktop.
Patterns.Prototype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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