Hi guys!
I found a lot of my answers on this webbie, so I registered myself.
I'm creating a java based quiz program.
Now i'm running into a lot of problems trying to get stuff working.
The problem i'm having now is the following:
I have a class Question, and 2 sub classes WrongCorrectQuestion, and MultipleChoiceQuestion.
Now, the class Question has String question, as attribute.
The class WrongCorrectQuestion has String answer as attribute. And getters and setters.
Now, in my (in the database class) method fillArray(), which should fill an array with objects from one of the two sub classes.
Now i try to do the following:
outputArray[counter] = new WrongCorrectQuestion();
outputArray[counter].setAnswer("stringvalue");
but I can only use the methods from the superclass Question. Eventho i instantiate it as a WrongCorrectQuestion object.
I think i'm missing some theory about this. Anyone could help me out? Thnx!
Ps: I could upload the entire program, but i'm belgian, and everything is in dutch, like var names and class names.
Thanks in advance guys!!