Created
November 30, 2016 14:28
-
-
Save zoffixznet/fafbdd1035fa7219c4c8f9c3bb108edc to your computer and use it in GitHub Desktop.
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
role Named { | |
has $.name is rw; | |
}; | |
class A does Named { | |
submethod TWEAK { $!name = "default" } | |
} | |
class B is A { | |
method rename($name) { self.name = $name } | |
} | |
my $b = B.new; | |
say $b.name; | |
$b.rename("seuss"); | |
say $b.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment