コード例 #1
0
ファイル: Owl.cs プロジェクト: Salomonsson/Animals
        public Owl(Animal other)
        {
            this.gender = other.Gender;
             this.name = other.Name;
             this.age = other.Age;
             this.id = other.Id;

             //Not protected - BAD, really BAD!
             this.speed = other.speed;

             //Instantiate foodSchedule
             myFood.Add("09:00 Möss");
             myFood.Add("04:00 Orm");
             myFood.Add("01:00 Kattunge");
        }
コード例 #2
0
ファイル: KookaBurra.cs プロジェクト: Salomonsson/Animals
        public Kookaburra(Animal other)
        {
            this.gender = other.Gender;
             this.name = other.Name;
             this.age = other.Age;
             this.id = other.Id;

             //Not protected - BAD, really BAD!
             this.speed = other.speed;

             //Instantiate foodSchedule
             myFood.Add("09:00 Bananer");
             myFood.Add("11:00 Spindlar och småkryp");
             myFood.Add("14:00 Gecko ödla och kackerlackor");
        }
コード例 #3
0
ファイル: Dog.cs プロジェクト: Salomonsson/Animals
        /// <summary>
        /// Kopiera data from Animal objekt. 
        /// </summary>
        /// <param name="other"></param>
        public Dog(Animal other)
        {
            this.gender = other.Gender;
            this.name = other.Name;
            this.age = other.Age;
            this.id = other.Id;

            //Vill använda mig av dessa properties. Men det går inte. Dessa är INTE skyddade.
            this.teeth = other.teeth;
            this.tail = other.tail;
            //this.teeth = other.teeth;
            //this.Sound = other.Sound;

            //myFood.Add("10:00 Pedigree");
            //myFood.Add("15:00 KingsMoore Original");
            //myFood.Add("15:30 Hills Adult Medium Hundfoder");
        }
コード例 #4
0
ファイル: Cat.cs プロジェクト: Salomonsson/Animal-OOP-C-
        public Cat(Animal other)
        {
            this.gender = other.Gender;
             this.name = other.Name;
             this.age = other.Age;
             this.id = other.Id;

             //Detta stämmer inte, jag kommer bara åt min variablar. Men i fallet vill jag komma åt min properties
             //i Mammals klassen.
             this.teeth = other.teeth;
             this.tail = other.tail;

             //myFood.Add("09:00 Whiskas");
             //myFood.Add("11:00 Orijen Cat & Kitten");
             //myFood.Add("14:00 Brit Care Monty Kitten");
             //myFood.Add("17:00 Whiskas Chicken");
             //myFood.Add("21:00 Whiskas Beef");
        }