Course of Raku / Objects, I/O, and exceptions / Classes and objects / Inheritance / Overriding methods

Quiz — Inheritance

What does the following program print?

class Animal {
    method speak { 'some sound' }
}

class Cow is Animal {
    method speak { 'Moo' }
}

say Cow.new.speak;
0some sound
1Moo
0Animal
0an error

Course navigation

Overriding methods   |   Employees and roles