oop - Ruby - Is there a way to call a method of the superclass with the same name of a method overloaded -


is possible like:

class   def a(var)     puts "do #{var}"   end end  class b <   def a(var)     var = var + "some modification"     #this want do:     super.a(var)   end end 

thanks!

unless i'm misreading question, should able call super itself; e.g.:

class   def a(var)     puts "do #{var}"   end end  class b <   def a(var)     var = var + "some modification"     #this want do:     #super.a(var)     super   end end  v = b.new v.a("hey") 

produces

$ ruby test.rb heysome modification 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -