+ 16

Why "Meow" and why not "Meow" and "Hi" ? Зашто "Meow" а не "Meow" и "Hi" ?

https://code.sololearn.com/cuirPI5zue8j/?ref=app

1st Feb 2018, 11:43 PM
Vučko/Вучко/Vuchko
Vučko/Вучко/Vuchko - avatar
3 ответов
+ 16
Thanks John Wells, Vukan and others !¡ Хвала John Wels, Vukan и другима !¡
2nd Feb 2018, 3:48 PM
Vučko/Вучко/Vuchko
Vučko/Вучко/Vuchko - avatar
+ 8
If you want both Meow & Hi, do this. If you want Hi first, put it before Meow line. class Cat < Animal def speak puts "Meow" super end end
2nd Feb 2018, 2:26 AM
John Wells
John Wells - avatar
+ 6
u izvedenoj klasi si definisao istu metodu kao i u nadredjenoj klasi i time preklopio metodu iz nadredjene klase. Ne moras kao u nekim programskim jezicima eksplicitno naglasiti da je ta metoda preklopljena
2nd Feb 2018, 12:11 AM
Vukan
Vukan - avatar