Ruby/Przedefiniowywanie metod: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
Szymon wro (dyskusja | edycje) m Ruby/Przedefiniowanie metod przeniesiono do Ruby/Przedefiniowywanie metod: Powinno być chyba jednak w formie niedokonanej. |
Szymon wro (dyskusja | edycje) |
||
Linia 1:
==
W podklasie możemy
<pre>
Linia 20:
I'm a person.
nil
ruby> class Student1 < Human
| def identify
| puts "I'm a student."
Linia 31:
</pre>
Przypuszczalnie
<pre>
Linia 50:
<pre>
ruby> class Dishonest < Human
| def train_toll(age)
| super(11) #
| end
| end
Linia 60:
nil
ruby> class Honest < Human
| def train_toll(age)
| super(age) #
| end
| end
|