static void Main(string[] args) { IMessageWriter writer = new ConsoleMessageWriter(); var salutation = new Salutation(writer); salutation.Exclaim(); }
static void Main(string[] args) { IMessageWriter writer = new SecureMessageWriter(writer: new ConsoleMessageWriter(), identity: GetIdentity()); var salutation = new Salutation(writer); salutation.Exclaim(); }
static void Main(string[] args) { /* * "notice that you wrap or decorate old ConsoleMessageWriter instance with new SecureMessageWriter class." */ IMessageWriter writer = new SecureMessageWriter(writer: new ConsoleMessageWriter(), identity: GetIdentity()); //<---- DECORATOR var salutation = new Salutation(writer); salutation.Exclaim(); }