I\'ve used super
to initialize parent class but I cannot see any way of calling parent class from subclass methods.
I know PHP and other languages do ha
Others have said it already well. Just one additional note of caution:
The syntax super.foo
to call method foo
in the super class is not supported. Rather it will call the super
-method and on the returned result, try to call foo
.
class A
def a
"A::a"
end
end
class B < A
def a
"B::a is calling #{super.a}" # -> undefined method `a` for StringClass
end
end