Question: this is not a question from a textbook or any webworks, this question is about java what to do with a subclass that has different
this is not a question from a textbook or any webworks, this question is about java
"what to do with a subclass that has different signature than the abstract class"
i have an abstract class Question, with its constructor:
// fields
public Question(double maxMark, String questionString) { assert (maxMark > 0); this.maxMark = maxMark; this.questionString = questionString; } and my subclass MultiplicationQuestion should have signature like this:
public MultiplicationQuestion(double maxMark, int factor1, int factor2)
intellij told me there no default constructor in Question and i cannot use super here as questioString is not in the field of the subclass.
can u give me help to figure out the correct way to figure out how to write the constructor of the subclasses that it has different signature and different filed with the abstract class?
ty
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
