Course of Raku / Objects, I/O, and exceptions / Classes and objects / Roles / Exercises
A dancing robot
Problem
Define a class Robot whose method speak
returns beep. Define a role Dancing that adds
a method dance returning spinning around.
Create two robots, but give the Dancing role to only one
of them. Print the result of speak for both robots, and
then the result of dance for the robot that can dance.
Example
The program prints:
beep
beep
spinning around