static void Main(string[] args) { // stream example, you can put a StreamWriter in an EncryptedStream and write an encrypted text to somewhere. // https://en.wikipedia.org/wiki/Decorator_pattern var player = new Player("Ken", Console.Out); player.Play(); var quester = new QuestingPlayer(player); var fighter = new FightingPlayer(quester); fighter.Play(); Console.WriteLine("{0} stopped questing.", player.Name); fighter = new FightingPlayer(player); fighter.Play(); Console.WriteLine(player.ToString()); Console.ReadLine(); }
public Player(Player player) { Writer = player.Writer; Name = player.Name; Level = player.Level; }
public SellingPlayer(Player player) : base(player) { _player = player; }
public FightingPlayer(Player player) : base(player) { _player = player; }
public QuestingPlayer(Player player) : base(player) { _player = player; }