static void Main(string[] args)
        {
            Client client = new Client();

            var simple = new Statue();

            Console.WriteLine("Client: I get a simple component:");
            client.ClientCode(simple);
            Console.WriteLine();
            Stand     decorator1 = new Stand(simple);
            Backlight decorator2 = new Backlight(decorator1);

            Console.WriteLine("Client: Now I've got a decorated component:");
            client.ClientCode(decorator2);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Statuette statuette = new Statuette();
            Stand     stand     = new Stand(statuette);

            Console.WriteLine($"{stand.GetName()}: {stand.GetWeight()} g");

            Photoframe frame  = new Photoframe();
            Stand      stand2 = new Stand(frame);

            Console.WriteLine($"{stand2.GetName()}: {stand2.GetWeight()} g");

            Photoframe frame2    = new Photoframe();
            Stand      stand3    = new Stand(frame2);
            Backlight  backlight = new Backlight(stand3);

            Console.WriteLine($"{backlight.GetName()}: {backlight.GetWeight()} g");

            Console.ReadLine();
        }