I'm trying to understand some of the nuances of inheritance but I can't find an answer to this question. Consider the following:
class SuperClass {
method foo {
print "in SuperClass.foo"
}
method bar {
print "in SuperClass.bar"
foo();
}
}
class SubClass inherits SuperClass {
method foo {
print "in SubClass.foo"
}
}
SubClass a = SubClass.new()
a.bar()
Is the output this:
in SuperClass.bar
in SuperClass.foo
Or this:
in SuperClass.bar
in SubClass.foo
Aucun commentaire:
Enregistrer un commentaire