Suppose I have a class Letter
and a lot of classes A
, B
, ..., all of them inherit from Letter
.
How can I choose a random child of Letter
?
I know it sounds a bit broad, but what I want is something like this
public Letter GetRandomLetter(){ //return a random instance of A, B or any child class}
The number of child classes is unknown so I can't just use some logic with random numbers to return an instance of each child class. I also don't want to use reflection.