[Ironruby-core] Sealed method can be overriden

Tomas Matousek Tomas.Matousek at microsoft.com
Sat Jun 13 16:10:59 EDT 2009


Yes, super should work if the calling method is in a Ruby base class.

C#:
public class C {
  public virtual int FooBar() { return 123; }
}

Ruby:
class D < C
  def foo_bar 
    10 * super
  end
end

p D.new.FooBar
p D.new.foo_bar

(there is a bug in the current bits that makes it throw an exception: `get_MethodHandle': The requested operation is invalid for DynamicMethod. (TypeError), I'll fix it asap).

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Shay Friedman
Sent: Saturday, June 13, 2009 12:36 PM
To: ironruby-core at rubyforge.org
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
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list