Role composition and multi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl6 | |
| role boo1 { | |
| multi method boo ($message) { | |
| say "Boo1: $message"; | |
| } | |
| } | |
| role boo2 { | |
| multi method boo () { | |
| say "Boo2"; | |
| } | |
| } | |
| class Boo does boo1 does boo2 { | |
| method boo () { | |
| say "Boo"; | |
| } | |
| } | |
| my $booable = Boo.new; | |
| $booable.boo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment