Answer the question
In order to leave comments, you need to log in
How to override a method in a child class with different parameters?
Hello!
The essence of the question: in the parent class there is a setSize () method, how to override this method in the child class to accept an argument? So setSize(double r) for example.
If you just declare a class or interface where this method does not accept anything and is abstract:
interface GeometricalFigures {
void setSize();
}
class Circles implements GeometricalFigures {
double radius;
public void setSize(double r) {
radius = r;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question