C#:
public class C {
public int FooBar() { return 123; }
}
Ruby:
require 'x.dll'
class D < C
def foo_bar
48
end
end
p D.new.FooBar # => 123
p D.new.foo_bar # => 48
The same rules hold here: foo_bar does NOT override FooBar (since FooBar is not
virtual) and therefore is an unrelated method.
So the first call resolves to C::FooBar and invokes it.
The second call resolves to D#foo_bar and invokes it. Only if there wasn't
foo_bar or FooBar defined in D this call would resolve to C::FooBar.
Tomas
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Shay Friedman
Sent: Saturday, June 13, 2009 12:36 PM
To: [email protected]
Subject: Re: [Ironruby-core] Sealed method can be overriden
The same happens with non-virtual methods as well.
By the way, should you be able to call super when you override a virtual
method?
Thanks,
Shay.
----------------------------
Shay Friedman
http://www.ironshay.com
Follow me: http://twitter.com/ironshay
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core