Example #1
0
        static void Main()
        {
            // Наследование первого типа (generic базовый класс, non-generic наследник)
            CatType           animalsT1_01 = new CatType(Sex.Male);
            AnimalsType <Sex> animalsT1_02 = new CatType(Sex.Male);
            AnimalsType <Sex> animalsT1_03 = new AnimalsType <Sex>(Sex.Male);

            // Наследование первого типа (generic базовый класс, generic наследник того же типа)
            AnimalsType <string> animalsT2_01 = new AnimalsType <string>("Male");
            AnimalsType <bool>   animalsT2_02 = new AnimalsType <bool>(true);

            // Наследование первого типа (generic базовый класс, generic наследник иного типа)
            CatType01 <int>   animalsT3_01 = new CatType01 <int>(Sex.Male);
            AnimalsType <Sex> animalsT3_02 = new CatType01 <int>(Sex.Male);
            AnimalsType <Sex> animalsT3_03 = new AnimalsType <Sex>(Sex.Male);

            // Наследование первого типа (generic базовый класс, generic наследник сочетание параметра базового класса и своих типов)
            CatType02 <int, Sex, object> animalsT4_01 = new CatType02 <int, Sex, object>(Sex.Male);
            AnimalsType <Sex>            animalsT4_02 = new CatType02 <long, Sex, long>(Sex.Male);
            AnimalsType <Sex>            animalsT4_03 = new AnimalsType <Sex>(Sex.Male);
        }
Example #2
0
 public Meat(string name, double energy, double proteinsCount, double fatsCount, double carbohydratesCount, bool isFrozen, AnimalsType animalsType)
     : this(name, energy, proteinsCount, fatsCount, carbohydratesCount, animalsType)
 {
     IsFrozen = isFrozen;
 }
Example #3
0
 public Meat(string name, double energy, double proteinsCount, double fatsCount, double carbohydratesCount, AnimalsType animalsType)
     : base(name, energy, proteinsCount, fatsCount, carbohydratesCount, false)
 {
     AnimalsType = animalsType;
 }
Example #4
0
 public Animal(AnimalsType animalType, string name, int hpTicks, Texture2D texture)
     : base(name, hpTicks, texture)
 {
     AnimalType = animalType;
 }