Reputation: 1
For Java programming. I've read through my text book, but I can't find it.
Upvotes: 0
Views: 347
Reputation: 67504
It depends on the context. If you do it like this:
public SubclassConstructor() {
super("foo");
}
This is passing in these arguments to the parent's constructor. If you do it like this:
public void subclassMethod() {
super.methodInBoth("foo");
}
@Overrides
public void methodInBoth(String var) {
}
This is calling the parent's method instead of the child's method. And, to solidify the lesson, if you did it like this:
public void subclassMethod() {
this.methodInBoth("foo");
}
@Overrides
public void methodInBoth(String var) {
}
It would call the child's method instead of the parent's method. If you just called methodInBoth("foo");
, that would also call the child's.
Upvotes: 1