Say I have an Abstract generic class:
public abstract class QuestionObject<T extends Answerable<?>> {
public abstract T returnAnswerable();
public abstract void renderQuestionLayout(T answer);
}
and a companion generic class to go with it:
public interface Answerable<T> {
...
}
I have a bunch of subclasses that extend QuestionObject and have their own particular Answerable. So for example, a TrueFalseQuestion would be declared with a TrueFalseAnswer:
public class TrueFalseQuestion extends QuestionObject<TrueFalseAnswer> {
...
}
Let's saw I want to call the method renderQuestionLayout at the QuestionObject level. Is that possible? Something like:
QuestionObject<?> q = getCurrentQuestion();
Answerable<?>a = getAnswer();
q.renderQuestionLayout(a);
doesn't work.