Beispiel #1
0
        static void Main(string[] args)
        {
            Product      product     = new Product("123", "213");
            Sweets       tech        = new Sweets("456", "789", "456789");
            Flower       tablet      = new Flower();
            IMyInterface myInterface = tablet;

            IAnotherInterface[] arr = new IAnotherInterface[3];
            arr[0] = product;
            arr[1] = tech;
            arr[2] = tablet;

            Console.WriteLine(product.ToString());
            Console.WriteLine(tech.ToString());
            Console.WriteLine(tablet.MyFunc());
            Console.WriteLine(myInterface.MyFunc());
            Console.WriteLine($"myInterface is IMyInterface = {myInterface is IMyInterface}");
            Console.WriteLine($"myInterface is Tabet = {myInterface is Flower}");
            foreach (IAnotherInterface x in arr)
            {
                Print.IAmPrinting(x);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100, 500);
            Sweets  nyam    = new Sweets("456", "789", "456789", 200, 1300);
            Flower  rose    = new Flower();
            Gift    gift    = new Gift(10);

            rose.info.price = 300;
            gift.Add(product);
            gift.Add(nyam);
            gift.Add(rose);
            gift.Add(new Sweets());
            gift.Add(new Clocks());
            gift.Add(new Product());

            gift.show();
            controller.show(gift);
            controller.sort(gift);
            gift.show();
            gift.Del(rose);
            gift.show();
            controller.minmas(gift);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100, 500);
            Sweets  nyam    = new Sweets("456", "789", "456789", 200, 1300);
            Flower  rose    = new Flower();
            Gift    gift    = new Gift(10);

            rose.info.price = 300;
            IAnotherInterface[] arr = new IAnotherInterface[3];
            arr[0] = product;
            arr[1] = nyam;
            arr[2] = rose;

            try
            {
                Gift WrongLab = new Gift(100);
                WrongLab.Del(rose);
                //arr[4].ToString();
                gift.Add(product);
                gift.Add(nyam);
                gift.Add(rose);
                gift.Add(new Sweets());
                gift.Add(new Clocks());
                gift.Add(new Product());
                //lab.Add(new Product());


                gift.show();
                controller.show(gift);
                controller.sort(gift);
                gift.show();
                gift.Del(rose);
                //lab.Del(scanner);
                gift.show();
            }
            catch (LabIsFull ex)
            {
                Console.WriteLine("GiftIsFull Exception");
                Console.WriteLine(ex.Message);
            }
            catch (ElementDoesNotExist ex)
            {
                Console.WriteLine("ElementDoesNotExist Exception");
                Console.WriteLine(ex.Message);
            }
            catch (LabIsEmpty ex)
            {
                Console.WriteLine("GiftIsEmpty Exception");
                Console.WriteLine(ex.Message);
            }
            catch (WrongSize ex)
            {
                Console.WriteLine("WrongSize Exception");
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Another Exception");
                Console.WriteLine(ex.Message);
            }
        }