Esempio n. 1
0
        public object Clone()
        {
            Product p = null;

            try
            {
                p = new UnderlinePen(this.ulchar);
            }
            catch (NotImplementedException e)
            {
                Console.WriteLine(e.Message);
            }
            return(p);
        }
Esempio n. 2
0
        public static void Main()
        {
            Manager      mgr       = new Manager();
            UnderlinePen underline = new UnderlinePen('~');
            MessageBox   mbox      = new MessageBox('*');
            MessageBox   sbox      = new MessageBox('/');

            mgr.register("strong message", underline);
            mgr.register("warning box", mbox);
            mgr.register("slash box", sbox);
            Product p1 = mgr.Create("strong message");

            p1.Use("Hello world.");
            Product p2 = mgr.Create("warning box");

            p2.Use("Hello world");
            Product p3 = mgr.Create("slash box");

            p3.Use("Hello world");
        }