Пример #1
0
        static void Main(string[] args)
        {
            Ocean     ocean   = new Ocean();
            Kontinent land    = new Kontinent("Africa");
            Island    island  = new Island("Kuba");
            State     state_1 = new State("The USA");
            State     state_2 = new State("The Belarus");
            World     world   = new World();

            world.Add(ocean);
            world.Add(land);
            world.Add(island);
            world.Add(state_1);
            world.Add(state_2);

            world.Show_List();
            Console.WriteLine();

            world.Del(state_1);

            world.Show_List();
            Console.WriteLine();

            Console.WriteLine(world.Get_Ocean());
            world.Get_Island();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Earth[] array = new Earth[3];
            Object  obj_1 = new Ocean();

            if (obj_1 is Ocean)
            {
                Console.WriteLine("Is Test!");
                Ocean ocean = (Ocean)obj_1;
                ocean.Show();
                ocean.Sound();
            }
            Object    obj_2 = new Kontinent("Africa");
            Kontinent land  = obj_2 as Kontinent;

            if (land != null)
            {
                array[0] = land;
                land.Show();
            }
            Island island = new Island("Kuba");

            array[1] = island;
            island.Show();
            island.Sound();
            IWater water = new Island("Kuba");

            water.Show();
            ((Island)water).Show();
            State state = new State("The USA");

            array[2] = state;
            state.Show();
            state.Messege();

            Console.WriteLine();

            foreach (var item in array)
            {
                Printer.IAmPrinting(item);
            }
        }