示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Animal brain     = new Animal("Brain");
            Animal asparagus = new Animal("Asparagus");

            //brain.Speak();
            //asparagus.Speak();

            Animal dog1 = new Dog("Michael");

            dog1.Speak();
            Dog newdog = (Dog)dog1;

            newdog.Speak();
            dog1.Move(7.5);
            System.Console.WriteLine(dog1.distance);
            // System.Console.WriteLine(dog1.Condition);

            Dog dog2 = new Dog("Hartley", 3, 2);

            dog2.Speak();
            dog2.Move(2.56);
            System.Console.WriteLine(dog2.distance);
            System.Console.WriteLine(dog2.Condition);
            //System.Console.WriteLine(dog2.legs);
            dog2.EatSnack();

            dog2.EatSnack();
        }
示例#2
0
        static void Main(string[] args)
        {
            Mammals m = new Mammals();
            Console.WriteLine(m.Move());
            Console.WriteLine(m.Greet());
            m = new Cat();
            Console.WriteLine(m.Move());
            Console.WriteLine(m.Greet());
            m = new Dog();
            Console.WriteLine(m.Move());
            Console.WriteLine(m.Greet());

            Console.WriteLine();

            Reptiles r = new Reptiles();
            Console.WriteLine(r.Move());
            Console.WriteLine(r.Temperature());
            r = new Crocodile();
            Console.WriteLine(r.Move());
            Console.WriteLine(r.Temperature());

            Console.WriteLine();

            Birds b = new Birds();
            Console.WriteLine(b.Move());
            Console.WriteLine(b.MakeNest());
            b = new Owl();
            Console.WriteLine(b.Move());
            Console.WriteLine(b.MakeNest());

            Console.WriteLine();

            Fish f = new Fish();
            Console.WriteLine(f.Move());
            f = new Shark();
            Console.WriteLine(f.Move());

            Console.ReadKey();
        }
示例#3
0
文件: Program.cs 项目: a-szeliga/test
        static void Main(string[] args)
        {
            Parrot p1 = new Parrot();

            p1.FlyAway();
            Horse h1 = new Horse();

            h1.BiteParrot();

            Animal an2 = new Parrot();

            an2.Move(1);


            Cat c = new Cat();

            //c.AnimalType = AnimalType.Cat;
            c.Sit();
            c.Jump();

            Dog d = new Dog();

            d.Move(7);
            d.Jump();

            Animal[] type = new Animal[2];
            type[0] = c;
            type[1] = d;

            for (int i = 0; i < type.Length; i++)
            {
                // if(type[i].AnimalType==AnimalType.Dog)
                Console.WriteLine(AnimalType.Cat);
                Console.WriteLine(AnimalType.Dog);
            }


            Console.ReadLine();

            Audi a1 = new Audi();

            a1.Engine = "v8";
            a1.Body   = "red";
            a1.Wheels = 4;
            a1.Name   = "nazwa";
            a1.Start(5);



            Console.ReadLine();

            Book test = new ProfessionalBook();

            test.Cover = true;
            test.Page  = 657;
            test.Title = "Selenium";
            test.Buy();
            test.Read();


            Console.ReadLine();
        }