The method foo()
is private, so you don’t inherit it and can’t call it directly from the C
class.
However, you can see private methods and constructor from B
since everything is declared in the same containing class, and access them with super
, which is why super()
works.
In the same way, you can access foo
with super.foo()
.
Note that you can redefine a new foo method in C
, but this method will not override B.foo()
.