I'm trying to set the Length field from the inherited class Bone. But only the fields from the base class Toy appears. Any ideas?
C#:
Pets[0].Name = "Brooom";
Pets[0].Toys[2].// Fields from inherited class missing
Creation of a new object of type Cat:
// Create dummy animals at start
Pets.Add(new Cat
{
Name = "Vroom",
Age = 3,
FavFood = "Mice",
Breed = "Ragdoll",
IsHungry = Application.ShuffleProbability(),
Toys =
new List<Toy> {
new Feather {Color = "Blue", Quality = 10},
new Ball {Color = "Black/White", Quality = 10},
new Bone {Length = 2, Quality = 10},
}
});
Super class Toy:
abstract class Toy
{
public string Color { get; set; }
public int Quality { get; set; }
}
Class: Bone:
class Bone : Toy
{
public int Length { get; set; }
}