A simplified example of what I'm trying to achieve is as follows:
public class Animal
{
public virtual Teeth teeth {get;set;}
}
public class Mouse : Animal
{
public override SmallTeeth teeth {get; set;}
}
This obviously does not work, since the teeth must be of the same type as in the Animal class, which will be overridden in the Mouse class. But can something like this be achieved when I am allowed to use a more derived type in any functions that are inherited from Animal? For example, if the Animal class contains a function for a bite:
public void Bite()
{
teeth.bite()
Console.WriteLine("Ouch")
}
I could call a function Bite()inherited from Animal, and it would use a field of class Mouse of type SmallTeeth. Is it possible? and is this the best way to do what I'm trying to do? If not, what will be the right approach to this problem?