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"); }
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"); }
/// <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"); }
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"); }