Exemplo n.º 1
0
        public CatClass(CatClass o, string s, CatKind k)
        {
            foreach (KeyValuePair<string, CatKind> kvp in o.GetFields())
                mpFields.Add(kvp.Key, kvp.Value);

            mpFields.Add(s, k);
        }
Exemplo n.º 2
0
        public CatClass(CatClass o, string s, CatKind k)
        {
            foreach (KeyValuePair <string, CatKind> kvp in o.GetFields())
            {
                mpFields.Add(kvp.Key, kvp.Value);
            }

            mpFields.Add(s, k);
        }
Exemplo n.º 3
0
 public void SetField(string s, Object o, CatClass c)
 {
     Trace.Assert(c.HasField(s));
     mpClass = c;
     if (!mValues.ContainsKey(s))
         mValues.Add(s, o);
     else
         mValues[s] = o;
 }
Exemplo n.º 4
0
 public void SetField(string s, Object o, CatClass c)
 {
     Trace.Assert(c.HasField(s));
     mpClass = c;
     if (!mValues.ContainsKey(s))
     {
         mValues.Add(s, o);
     }
     else
     {
         mValues[s] = o;
     }
 }
Exemplo n.º 5
0
 public void AddField(CatClass x, string s, Object o)
 {
     Trace.Assert(x.HasField(s));
     mpClass = x;
     mValues.Add(s, o);
 }
Exemplo n.º 6
0
 public CatObject(CatClass x)
 {
     mpClass = x;
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var cat = new CatClass();

            cat.ChangeCatColor();
            int a;

            Console.WriteLine("Введит возраст кошки");
            Console.Write("Возраст кошки = ");
            cat.CatAge = int.Parse(Console.ReadLine());
            Console.WriteLine();

            bool access = false;

            do
            {
                Console.Clear();
                Console.Write("Имя кошки - ");
                Console.WriteLine(cat.Name);
                Console.Write("Возраст кошки - ");
                Console.WriteLine(cat.CatAge);
                Console.Write("Цвет кошки - ");
                Console.WriteLine(cat.CurrentColor);

                Console.WriteLine("Выберите пункт меню:");
                Console.WriteLine("1.Задать имя кошки\n2.Задать здоровый цвет кошки\n3.Задать больной цывет кошки\n4.Кормить\n5.Бить\n0.Выйти из меню");
                a = int.Parse(Console.ReadLine());
                int b;
                switch (a)
                {
                case 1:
                    Console.Write("Введите имя кошки\n");
                    Console.Write("Имя кошки - ");
                    cat.Name = Console.ReadLine();
                    break;

                case 2:
                    Console.Write("Введите здоровый цвет кошки\n");
                    Console.Write("Здоровый цвет кошки - ");
                    cat.colors.HealthyColor = Console.ReadLine();
                    break;

                case 3:
                    Console.Write("Введите больной цвет кошки\n");
                    Console.Write("Больной цвет кошки - ");
                    cat.colors.SickColor = Console.ReadLine();
                    break;

                case 4:
                    Console.Write("На сколько покромить кошку?\nЕды = ");
                    b = int.Parse(Console.ReadLine());
                    cat.Feed(b);
                    break;

                case 5:
                    Console.Write("На сколько бить кошку?\nУдары = ");
                    b = int.Parse(Console.ReadLine());
                    cat.Punish(b);
                    break;

                case 0:
                    Console.Clear();
                    access = true;
                    break;
                }
            } while (!access);
            Console.WriteLine("Вы вышли из меню, для закрытия программы нажмите любую клавишу.");
            Console.ReadKey();
        }
Exemplo n.º 8
0
 public void AddField(CatClass x, string s, Object o)
 {
     Trace.Assert(x.HasField(s));
     mpClass = x;
     mValues.Add(s, o);
 }
Exemplo n.º 9
0
 public CatObject(CatClass x)
 {
     mpClass = x;
 }