13.2 Inheriting Methods
This commit is contained in:
parent
db403da4b2
commit
1dd608294a
1 changed files with 5 additions and 0 deletions
|
@ -19,6 +19,10 @@ class LoxClass implements LoxCallable {
|
|||
return methods.get(name);
|
||||
}
|
||||
|
||||
if (superclass != null) {
|
||||
return superclass.findMethod(name);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -37,6 +41,7 @@ class LoxClass implements LoxCallable {
|
|||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int arity() {
|
||||
LoxFunction initializer = findMethod("init");
|
||||
|
|
Loading…
Reference in a new issue