[Ruby] Вызов переопределенного метода базового класса из дочернего

Lexa lexa at mai.ru
Fri Oct 11 16:13:11 MSD 2002


 class A
 public
     def qqq()
         puts "B"
     end
 end

class B < A
 public
     def qqq()
         puts "BB"
     end

     def www()
         # Как отсюда вызвать A::qqq ?
	a = A.new
	a.qqq()
     end
 end

b = B.new
b.www()

#выведет: B
-- 
Alexey Gladkov (Legion)
E-MAIL: lexa at mai.ru




More information about the Ruby mailing list