Example #1
0
        static void Main(string[] args)
        {
            Program program = new Program();

            program._age = 4;
            int  age  = program._age;
            Cat  cat  = new Cat();
            Heir heir = new Heir();

link:
            Console.WriteLine("Порода кошки: " + heir.BreedMetod());
            Console.WriteLine("Срок жизни: " + heir.TermLifeMetod());
            Console.WriteLine("Текущий возраст: " + age);
            Console.WriteLine("Прибавить '1' к возрасту?  y/n");
            var userVariable = Convert.ToString(Console.ReadLine());

            if (CheckMetod(userVariable) == 1)
            {
                age++;
                goto link;
            }
            if (CheckMetod(userVariable) == 0)
            {
                goto link;
            }
            if (CheckMetod(userVariable) == 10)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Введенная строка имела неверный формат");
                Console.ResetColor();
                goto link;
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            //繼承者類別
            Heir heir = new Heir();

            //呼叫繼承者的變數
            heir.name  = "Gaby";
            heir.money = 10000000;

            heir.View();
            //呼叫繼承者的方法
            heir.Func();

            Abs abs = new Abs();

            abs.Func();
        }
Example #3
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + Id.GetHashCode();
            hash = hash * 23 + Name.GetHashCode();
            hash = hash * 23 + Seats.GetHashCode();
            hash = hash * 23 + Region.GetHashCode();
            hash = hash * 23 + CoatOfArms.GetHashCode();
            hash = hash * 23 + Words.GetHashCode();
            hash = hash * 23 + Titles.GetHashCode();
            hash = hash * 23 + CurrentLord.GetHashCode();
            hash = hash * 23 + Founder.GetHashCode();
            hash = hash * 23 + Founded.GetHashCode();
            hash = hash * 23 + Heir.GetHashCode();
            hash = hash * 23 + Overlord.GetHashCode();
            hash = hash * 23 + DiedOut.GetHashCode();
            hash = hash * 23 + AncestralWeapons.GetHashCode();
            hash = hash * 23 + CadetBranches.GetHashCode();

            return(hash);
        }