示例#1
0
        static Outerwear create_out(Random rnd)
        {
            Outerwear a = new Outerwear();

            a.Id = id_counter;
            id_counter++;
            a.name   = type_outerwear[rnd.Next(0, 3)];
            a.size   = rnd.Next(30, 50);
            a.height = rnd.Next(150, 200);
            return(a);
        }
示例#2
0
        static void writer(object a) //вывод одного элемента с приведением типа
        {
            if (a is Outerwear)
            {
                Outerwear out_a = (Outerwear)a;
                Console.WriteLine("Id: {0}", out_a.Id);
                Console.WriteLine("Название: {0}", out_a.name);
                Console.WriteLine("Размер: {0}", out_a.size);
                Console.WriteLine("Рост: {0}", out_a.height);
                Console.WriteLine();
            }

            if (a is Footwear)
            {
                Footwear foot_a = (Footwear)a;
                Console.WriteLine("Id: {0}", foot_a.Id);
                Console.WriteLine("Название: {0}", foot_a.name);
                Console.WriteLine("Размер: {0}", foot_a.size);
                Console.WriteLine();
            }
        }
示例#3
0
        static void writer(object a)
        {
            if (a is Outerwear)
            {
                Outerwear out_a = (Outerwear)a;
                Console.WriteLine("Id: {0}", out_a.Id);
                Console.WriteLine("Название: {0}", out_a.name);
                Console.WriteLine("Размер: {0}", out_a.size);
                Console.WriteLine("Рост: {0}", out_a.height);
                Console.WriteLine();
            }

            if (a is Footwear)
            {
                Footwear foot_a = (Footwear)a;
                Console.WriteLine("Id: {0}", foot_a.Id);
                Console.WriteLine("Название: {0}", foot_a.name);
                Console.WriteLine("Размер: {0}", foot_a.size);
                Console.WriteLine();
            }
        }
示例#4
0
        static object init(Random rnd)
        {
            if (rnd.Next() % 2 == 1)
            {
                Outerwear a = new Outerwear();
                a.Id = id_counter;
                id_counter++;
                a.name   = type_outerwear[rnd.Next(0, 3)];
                a.size   = rnd.Next(30, 50);
                a.height = rnd.Next(150, 200);
                return(a);
            }

            else
            {
                Footwear b = new Footwear();
                b.Id = id_counter;
                id_counter++;
                b.name = type_footwear[rnd.Next(0, 2)];
                b.size = rnd.Next(30, 50);
                return(b);
            }
        }