示例#1
0
        static void Main(string[] args)
        {
            //KONSOLA
            Console.WriteLine("KOT");

            //PĘTLA
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("LUBIĘ KOTY");
            }

            //METODA
            Console.WriteLine(WriteString());

            //METODA Z WARUNKIEM
            Console.WriteLine(TestString());

            //KLASA
            var kot = new Cat("Garfield", "Red", 2, 1.3f);

            Console.WriteLine(kot.Name);
            kot.Meow();
            kot.Feed("Chrupki");

            //WYŁĄCZNIK
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            //Instance of the derived class
            Dog Spotty = new Dog();

            Spotty.name      = "Spotty";
            Spotty.age       = 4;
            Spotty.happiness = 0.8f;
            Spotty.SpotCount = 25;
            Spotty.PrintBase();
            Spotty.Bark();
            Console.WriteLine("New Happiness " + Spotty.happiness);

            Console.WriteLine();

            //Instance of the derived class
            Cat Bruno = new Cat();

            Bruno.name      = "Bruno";
            Bruno.age       = 12;
            Bruno.happiness = 0.2f;
            Bruno.Cuteness  = 45;
            Bruno.PrintBase();
            Bruno.Meow();

            //await user input
            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            Cat cat = new Cat();

            cat.Meow();
            cat.Walk();

            Console.ReadLine();
        }
示例#4
0
        static void Main(string[] args)
        {
            Cat cCat = new Cat();

            cCat.Hiss();

            Cat.Meow();

            Console.Read();
        }