Beispiel #1
0
        static void Main(string[] args)
        {
            Candy     candy   = new Candy("green");
            Regular   regular = new Regular("purple");
            ColorBomb bomb    = new ColorBomb("multicolored");
            Striped   striped = new Striped("red");
            Wrapped   wrapped = new Wrapped("yellow");

            // Print all candies
            candy.printDisplay();
            regular.printDisplay();
            bomb.printDisplay();
            striped.printDisplay();
            wrapped.printDisplay();
        }
        static void Main(string[] args)
        {
            //objects instantiated
            Regular   reg  = new Regular("red");
            Striped   str  = new Striped("blue");
            ColorBomb bomb = new ColorBomb("rainbow");
            Wrapped   wrap = new Wrapped("green");

            //reg.Print();
            //reg.PrintRegular();
            //str.Print();
            //str.PrintStriped();
            //bomb.Print();
            //bomb.PrintColorBomb();
            //wrap.Print();
            //wrap.PrintWrapped();
            //objects displayed
            reg.Display();
            str.Display();
            bomb.Display();
            wrap.Display();
        }