Hello,
I have this class :
class A
def toto
puts "tttt"
end
end
class B < A
def tata
end
end
I would like to now how in B.tata I can invoke, I can call the method
toto of A.
Thanks for your reply....
···
--
Posted via http://www.ruby-forum.com/.
Mickael Veovis wrote:
Hello,
I have this class :
class A
def toto
puts "tttt"
end
end
class B < A
def tata
end
end
I would like to now how in B.tata I can invoke, I can call the method
toto of A.
Thanks for your reply....
If I understand your question correctly:
b = B.new
b.toto
or:
B.new.toto
Best regards,
Jari Williamsson
class B < A
def tata
toto
end
end
Kind regards,
Nicolai
I wrote:
If I understand your question correctly:
Well, I probably misunderstood your it the first time around 
Here's probably what you were looking for:
class B < A
def tata
toto
end
end
and then:
b = B.new
b.tata
or:
B.new.tata
Sorry, but I make a mistake my class are :
class A
def toto
puts "tttt"
end
end
class B < A
def toto
puts "mmmmm"
end
def tata
end
end
And I would like in B.tata to call the method toto of A.
···
--
Posted via http://www.ruby-forum.com/.
Mickael Rouvier wrote:
class A
def toto
puts "tttt"
end
end
class B < A
def toto
puts "mmmmm"
end
def tata
end
end
And I would like in B.tata to call the method toto of A.
def tata
A.instance_method(:toto).bind(self).call
end
HTH,
Sebastian
···
--
Jabber: sepp2k@jabber.org
ICQ: 205544826
class A
def toto
puts "tttt"
end
end
class B < A
alias :totoo :toto
def toto
puts "mmmm"
end
end
b = B.new
b.toto
b.totoo
- Karl-Heinz
···
On 15.02.2008, at 14:17, Sebastian Hungerecker wrote:
Mickael Rouvier wrote:
class A
def toto
puts "tttt"
end
end
class B < A
def toto
puts "mmmmm"
end
def tata
end
end
And I would like in B.tata to call the method toto of A.