Esempio n. 1
0
            static void Main(string[] args)                             //main method
            {
                Dog puppy = new Dog("Orion", "Shawn", 1, Gender.Male);  // create object instance

                puppy.Bark(3);                                          // output: Woof!Woof!Woof!
                Console.WriteLine(puppy.GetTag());                      // output: If lost, call Shawn. His name is Orion and he is 1 year old.

                Dog myDog = new Dog("Lileu", "Dale", 4, Gender.Female); // create object instance

                myDog.Bark(1);                                          // output: Woof!
                Console.WriteLine(myDog.GetTag());                      // output: If lost, call Dale. Her name is Lileu and she is 4 years old.
                Console.ReadLine();
            }
Esempio n. 2
0
        static void Main(string[] args)
        {
            /*Animal nurr = new Animal();
            *  nurr.name = "Nurr";
            *  nurr.age = 15;
            *  nurr.levelOfHappiness = 0.1;
            *  nurr.PrintAnimalBaseInfo();*/

            Dog scooby = new Dog();

            scooby.name             = "ScoobyDoo";
            scooby.age              = 1;
            scooby.levelOfHappiness = 0.1;
            scooby.spotCount        = 5;
            scooby.PrintAnimalBaseInfo();

            Cat miisu = new Cat();

            miisu.name             = "Miisu";
            miisu.age              = 2;
            miisu.levelOfHappiness = 0.5;
            miisu.levelOfCuteness  = 1;
            //Cat Meows
            for (int i = 0; i < 10; i++)
            {
                miisu.Meow();
            }
            miisu.ShowLevelOfCuteness();

            //Dog Barks
            for (int i = 0; i < 20; i++)
            {
                scooby.Bark();
            }

            miisu.HearBarks(scooby.numbersOfBarks);
            if (miisu.levelOfHappiness < 0)
            {
                Console.WriteLine($"{miisu.name} died of stress.");
                miisu = null;
            }


            scooby.ShowNumberOfDogSpots();
            scooby.ShowLevelOfHappiness();

            Console.ReadLine();
        }
Esempio n. 3
0
        static void Objects()
        {
            Dog dog = new Dog();

            dog.Color = "Blue";
            dog.Race  = "Chihuahua";

            dog.Bark(); // "Bark"

            Dog dog2 = new Dog();

            dog2.Color = "Green";
            dog2.Race  = "Goodboy";

            dog2.Bark(); // "Bark"

            Console.WriteLine(dog2.Fetch("stick"));

            Human human = new Human(dog);

            human.Name       = "Julius";
            human.BestFriend = dog2;
        }