Say I have this abstract class
abstract class Animal{
static dynamic getSound(){}
}
And this other class extending it
class Dog extends Animal{
static dynamic getSound(){
return "Woof";
}
}
And I want to use a method to access the static method of those classes by sending the type of Animal I want, like this:
dynamic getAnimalSound<T extends Animal>(){
return T.getSound();
}
Except this doesn't work because it isn't assumed that T extends Animal so there I can't access it.
What can I do make this getAnimalSound method working?