Neither interfaces nor abstract classes can dictate to subclasses the kind of constructor to implement (see How can I force a Constructor to be defined in all subclass of my abstract class)
Now I have an interface that is implemented by many subclasses. The program discovers these sub-classes at runtime through reflection.
I'd like to have a plugin factory that instantiate them (see here for an example).
The problem is that all examples assume that all subclasses have a specific type of constructor (no arguments, for example). But I can't really be sure about this. Since I can't enforce subclasses to have a specific constructor what should I do to avoid runtime errors?
Thank you!