static void Main(string[] args)
        {
            Animal animal = new Animal();
            //Console.WriteLine(animal.Id);
            //Console.WriteLine(animal._privateProperty);

            Dog dog = new Dog("Barnie", "Brown", "Labrador");

            Console.WriteLine(dog.Name);
            //Name property is public, inherited from Animal, also belongs to Dog
            dog.Name = "Sparkie";
            Console.WriteLine(dog.Name);
            // Console.WriteLine(dog._privateProperty); -> private property
            // Console.WriteLine(dog.Id); _> protectd property

            dog.PrintId();
            //inherited method from Animal
            dog.PrintBasicInfo();

            Cat cat = new Cat()
            {
                Name = "Garfield", Color = "Orange", IsLazy = true
            };

            cat.PrintBasicInfo();
            //method from Animal
            dog.Eat("Meat");
            //method from Dog
            dog.Eat();
            //method from Cat
            cat.Eat("Fish");

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Animal animal = new Animal("green");

            animal.Eat("food");

            Dog dog = new Dog("blue", "bichon");

            dog.Eat("bones");
            dog.Bark();

            Snake snake = new Snake("yellow", false);

            snake.Bite();

            HuntingDog huntingDog = new HuntingDog("pink", "chihuahua", 120);

            huntingDog.Hunt();


            Animal[] animals = new Animal[]
            {
                animal,
                dog,
                snake,
                huntingDog
            };

            Console.WriteLine("Iterating through the animals array");

            foreach (var a in animals)
            {
                a.Eat("food for animals");
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            // Creating instances of all animals to see what constructors will be called
            // All animals have access to methods from Animal
            Animal dambo = new Animal()
            {
                Name = "Dambo", Id = 5, Type = "Elephant"
            };

            dambo.PrintInfo();
            dambo.Eat();
            Console.WriteLine("----------------------------------------------------------");
            Dog spark = new Dog()
            {
                Name = "Spark", Id = 2, Type = "Dog", Race = "Labrador"
            };

            spark.PrintInfo();
            spark.Eat();
            spark.Bark();
            Console.WriteLine("----------------------------------------------------------");
            Cat garfield = new Cat()
            {
                Name = "Garfield", Id = 3, Lazyness = "Very"
            };                                                                         // We don't tell the type here because the constructor will set it

            garfield.PrintInfo();
            garfield.Eat();
            garfield.Meow();
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            //Animal cat = new Animal(1, "Garfield", "Cat");
            //Animal dog = new Animal(2, "Bark", "Dog");
            //Dog dog = new Dog();
            //dog.Id = 2;
            //dog.Name = "Bark";
            //dog.Type = "Dog";
            Dog dog = new Dog(2, "Bark", "Sharplaninec");
            Cat cat = new Cat("High", "High", 1, "Garfield");

            Console.WriteLine(dog.Eat());
            Console.WriteLine(cat.GetInfo());

            Console.WriteLine(dog.Bark());
            Console.WriteLine(cat.Meow());

            Tiger tiger = new Tiger("Low", "Medium", 3, "TigerName");

            Console.WriteLine(tiger.Meow());
            Console.WriteLine(cat.Eat());
            Console.WriteLine(tiger.Eat());


            //Demo ENUMS
            Human human = new Human("Risto", "Panchevski", new DateTime(1989, 7, 20), Days.Sun);

            Console.WriteLine(human.GetInfo());
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Dog myDog = new Dog("Pepper", 4, 0, false, true, "Dog Bone");

            myDog.Bark();
            myDog.Eat();
            myDog.Sleep();

            DancingCat someCrazyCat = new DancingCat(" electric slide", "Meow the dancing cat");

            someCrazyCat.Eat();      //can eat because she's an animal
            someCrazyCat.Meow();
            someCrazyCat.AnnoyYou(); // can meow and annoy you because she's a cat
            someCrazyCat.Dance();    //can dance because she's a dancing cat.

            Fish bigFish = new Fish(false);

            bigFish.Breath();

            int money = 0;

            money += bigFish.Sell();
            money += myDog.Sell();
            money += someCrazyCat.Sell();
            Console.WriteLine("After selling my pets, I have " + money);

            Customer customer1 = new Customer("Marcus", "Tadwell");

            customer1.membership.ChangeMembership(MemberShip.Level.Preimum);
            customer1.membership.plan.ChangeRenewal(Plan.Renewal.Annual);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Dog dog = new Dog();

            dog.Eat();
            dog.Bark();
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Animal animal = new Animal("Animal", true, true, 5, 5);
            Dog    dog    = new Dog("Golden Retriever", 8, 20, 2, 4, 1, 20, "long silky");

            animal.Eat();
            dog.Eat();
            dog.Walk();
            dog.Run();

            Console.Read();
        }
Exemple #8
0
        static void Main(string[] args)
        {
            Dog jango = new Dog()
            {
                Id   = 1,
                Name = "Jango",
                //Type = "Dog",
                Race = "Poodle"
            };

            jango.PrintInfo();
            jango.Eat();

            jango.Bark();

            Console.WriteLine();

            Animal dambo = new Animal()
            {
                Id   = 2,
                Name = "Dambo",
                Type = AnimalTypes.Other
            };

            dambo.PrintInfo();
            dambo.Eat();

            Console.WriteLine();

            Cat kitty = new Cat()
            {
                Id   = 3,
                Name = "Kitty",
                //Type = "Cat",
                Laziness = "Very lazy"
            };

            kitty.PrintInfo();
            kitty.Meow();
            kitty.Eat();

            Console.WriteLine();

            WeekDays tuesday = WeekDays.Tuesday;

            Console.WriteLine(tuesday);
            Console.WriteLine(tuesday.ToString() == "Tuesday");
            Console.WriteLine(tuesday == (WeekDays)2);

            Console.WriteLine();

            Mouse mouse = new Mouse();
        }
        public void Run()
        {
            var fluf = new Cat();

            Console.WriteLine($"{fluf.Speak()}");
            fluf.Purr();
            fluf.Eat();

            var spot = new Dog();

            Console.WriteLine($"{spot.Speak()}");
            spot.Breed = "Chihuahua";
            spot.TellBreed();
            spot.Eat();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Puppy puppy = new Puppy();//Multiple Inheritance

            puppy.Eat();
            puppy.Bark();
            puppy.Weep();
            Dog dog = new Dog();//Single Inheritance

            dog.Bark();
            dog.Eat();
            Cat cat = new Cat();//Heirarchial Inheritance

            cat.Meow();
            cat.Eat();
        }
        static void Main(string[] args)
        {
            Dog objDog = new Dog();

            objDog.Bark();
            objDog.Eat();

            Console.WriteLine("//////////////////////////");

            Cat objCat = new Cat();

            objCat.Meow();
            objCat.Eat();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Animal dambo = new Animal()
            {
                Id   = 2,
                Name = "Dambo",
                Type = AnimalTypes.Other
            };

            dambo.PrintInfo();
            dambo.Eat();
            Dog jango = new Dog()
            {
                Id   = 1,
                Name = "Jango",
                Race = "Pudle"
            };

            // methods that dog inherits from animal
            jango.PrintInfo();
            jango.Eat();
            // method that is specific only for dog
            jango.Bark();

            Cat kitty = new Cat()
            {
                Id       = 3,
                Name     = "Kitty",
                Lazyness = "Very"
            };

            Console.WriteLine("-------------------------------------------------------------");
            //kitty.Meow();
            //kitty.PrintInfo();
            //kitty.Eat();
            Console.WriteLine(kitty.Type);

            Mouse mouse = new Mouse();

            // casting
            //int castedValue = (int)WeekDays.Tuesday;
            //int number = 5;
            //WeekDays tuesday = (WeekDays)number;
            //Console.WriteLine(tuesday);
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Animal dumbo = new Animal()
            {
                Id   = 1,
                Name = "Dumbo",
                Type = "elephant",
                // IsHappy = true - we can't access this here
            };

            dumbo.PrintInfo();
            dumbo.Eat();
            Console.WriteLine("-----------------------------------------");

            Dog baron = new Dog()
            {
                Id   = 2,
                Type = "dog",
                Name = "Barron",
                Race = "German sheppard"
            };

            baron.PrintInfo();
            baron.Eat();
            baron.Bark();
            baron.IsDogHappy();
            Console.WriteLine("-----------------------------------------");

            Cat garfield = new Cat()
            {
                Id       = 3,
                Name     = "Garfield",
                Laziness = "very much"
            };

            // we don't tell the type here
            garfield.PrintInfo();
            garfield.Eat();
            garfield.Meow();
            Console.WriteLine("-----------------------------------------");

            Console.ReadLine();
        }
Exemple #14
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Single Inheritance");

            /*Console.WriteLine("Multiple Inheritance");
             * Puppy puppy = new Puppy();
             * puppy.Eat();
             * puppy.Bark();
             * puppy.Weep();*/
            Console.WriteLine("Hierarchial Inheritance");
            Dog dog = new Dog();

            dog.Eat();
            dog.Bark();
            Cat cat = new Cat();

            cat.Eat();
            cat.Meow();
        }
Exemple #15
0
        static void Main(string[] args)
        {
            Dog myDog = new Dog();

            myDog.Eat();
            myDog.Bark();
            Console.WriteLine();

            Puppy myPyppy = new Puppy();

            myPyppy.Eat();
            myPyppy.Bark();
            myPyppy.Weep();
            Console.WriteLine();

            Cat myCat = new Cat();

            myCat.Eat();
            myCat.Meow();
        }
Exemple #16
0
        static void Main(string[] args)
        {
            Dog rex = new Dog("Rex");

            rex.SayWoof();
            rex.Eat();


            Cat firstCat = new Cat("Murzik");

            firstCat.SayMeow();
            firstCat.Eat();


            Bird greatBird = new Bird("Eagle");

            greatBird.Chirip();
            greatBird.Eat();
            Console.ReadKey();
        }
Exemple #17
0
        static void Main(string[] args)
        {
            Animal animal = new Animal()
            {
                Id   = 1,
                Name = "Ben",
                Type = "Dog",
            };

            Dog majlo = new Dog()
            {
                Id    = 2,
                Name  = "Majlo",
                Type  = "Dog",
                Breed = "Husky"
            };

            Cat garfild = new Cat()
            {
                Id       = 3,
                Name     = "Garfild",
                Lazyness = "Very"
            };

            Tiger tiger = new Tiger()
            {
                Id       = 4,
                Name     = "Tiger",
                Lazyness = "Non",
            };

            animal.Eat();
            majlo.Eat();
            garfild.Eat();
            garfild.Meow();
            tiger.Eat();
            tiger.Meow();
            tiger.PrintInfo();

            Console.ReadLine();
        }
Exemple #18
0
        static void Main(string[] args)
        {
            Dog   fido  = new Dog();
            Puppy puppy = new Puppy();
            Cat   cat   = new Cat();

            Console.WriteLine("Fido:");
            fido.Eat();
            fido.Bark();
            Console.WriteLine();

            Console.WriteLine("Puppy:");
            puppy.Eat();
            puppy.Bark();
            puppy.Weep();
            Console.WriteLine();

            Console.WriteLine("Cat:");
            cat.Eat();
            cat.Meow();
        }
Exemple #19
0
        static void Main(string[] args)
        {
            Animal animal = new Animal();

            Console.WriteLine(animal.Eat());

            Dog dog = new Dog();

            Console.WriteLine(dog.Eat());
            Console.WriteLine(dog.Bark());

            Cat cat = new Cat();

            Console.WriteLine(cat.Eat());
            Console.WriteLine(cat.Meow());

            Puppy puppy = new Puppy();

            Console.WriteLine(puppy.Eat());
            Console.WriteLine(puppy.Bark());
            Console.WriteLine(puppy.Weep());
        }
Exemple #20
0
        static void Main(string[] args)
        {
            //Dog class
            Dog d = new Dog();
            List<Animal> animals = new List<Animal>();
            animals.Add(new Dog());
            animals.Add(new Cat());
            animals.Add(new Cow());

            foreach (Animal ani in animals)
            {
                ani.Name();
                ani.Age();
                ani.Speak();
                ani.Move();

                d.Eat();
                d.Sleep();
            }

            Console.ReadKey();
        }
Exemple #21
0
        static void Main(string[] args)
        {
            Console.WriteLine("Inheritance in C#!");
            Console.WriteLine("------------------------------");

            Animal dumbo = new Animal()
            {
                Id   = 1,
                Name = "Dumbo",
                Type = "elephant"
                       // IsHappy = true - we can't access it here it's protected
            };

            dumbo.PrintInfo();
            dumbo.Eat();
            Console.WriteLine("------------------------------");
            Dog vele = new Dog()
            {
                Id    = 2,
                Type  = "dog",
                Name  = "Vele",
                Breed = "dzukela"
            };

            vele.PrintInfo();
            vele.Eat();
            vele.Bark();
            vele.IsDogHappy();
            Console.WriteLine("------------------------------");
            Cat garfield = new Cat()
            {
                Id       = 3,
                Name     = "Garfield",
                Laziness = "very much"
            };

            // we don't tell the type
            garfield.PrintInfo();
            garfield.Eat();
            // another overload is
            garfield.Eat("fish");
            garfield.Meow();
            Console.WriteLine("------------------------------");

            #region Enums
            // Enumerators
            Console.WriteLine(DayOfWeek.Tuesday);
            DiscountDay dayOne = new DiscountDay()
            {
                Discount = 10,
                Day      = DayOfWeek.Monday
            };
            Console.WriteLine($"On {dayOne.Day} you would have {dayOne.Discount}% discount");
            int dayOneInteger = (int)dayOne.Day;
            Console.WriteLine(dayOneInteger);

            // casting into integer
            DateTime today = DateTime.Now;
            // casting into integer
            int dayWeekToday = (int)today.DayOfWeek;
            Console.WriteLine(dayWeekToday);
            #endregion
            Console.ReadLine();
        }