Esempio n. 1
0
        static void TestInterfaceWidgets()
        {
            Widget      w1 = new Widget();
            AdvWidget   aw = new AdvWidget();
            SuperWidget sw = new SuperWidget();

            List <IPrintable> widgets = new List <IPrintable>()
            {
                w1, aw, sw
            };

            foreach (IPrintable widge in widgets)
            {
                widge.Print();
            }
        }
Esempio n. 2
0
        static void TestInterfaceWidgets()
        {
            var w1 = new Widget();
            var aw = new AdvWidget();
            var sw = new SuperWidget();

            var widgets = new List <IPrintable>();

            widgets.Add(w1);
            widgets.Add(aw);
            widgets.Add(sw);

            foreach (var widget in widgets)
            {
                widget.Print();
            }
        }