I\'m trying to make a function that takes one of many classes that extends Foo, and return a new instance of that object in its Class, not a new instance of F
Foo
F
Look at Abstract Factory pattern.