I want to do the following in Java:
SuperClass s = Class.forName("fully-qualified-class").newInstance();
s.process(foo, bar);
I know that given what "fully-qualified-class" is I can call process on s, but Java's static typing thinks I can't, so it won't let me.
Update: I'd like to correct myself a little: Ultimately, the real reason that you can't call process on s is because on the base class the process method is protected, whereas on the subclasses I need to call it on it's public. So, you could argue that this is really a case where access controls (not static typing) are getting in the way, or a case where the access controls on this class hierarchy weren't designed well enough. I lumped this in with static typing because in a normal message-passing style of OO this wouldn't be an issue, since the message would be passed and the object would either accept or reject it.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):