예제 #1
0
        static void Main(string[] args)
        {
            IMessageWriter writer     = new ConsoleMessageWriter();
            var            salutation = new Salutation(writer);

            salutation.Exclaim();
        }
예제 #2
0
        static void Main(string[] args)
        {
            IMessageWriter writer     = new SecureMessageWriter(writer: new ConsoleMessageWriter(), identity: GetIdentity());
            var            salutation = new Salutation(writer);

            salutation.Exclaim();
        }
예제 #3
0
        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();
        }