-
-
Save cygx/a3de36abd398431c6e8513f13bd619e4 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
multi sub trait_mod:<is>(Method $m, :$accessible!) { | |
$m.package.WHO{$m.name} = $m; | |
} | |
class A { | |
has $.name = "default"; | |
method !rename($name) is accessible { | |
$!name = $name; | |
} | |
} | |
class B is A { | |
method make-me-a-foo { | |
A::rename(self, "foo"); | |
} | |
} | |
my $b = B.new; | |
say $b.name; | |
$b.make-me-a-foo; | |
say $b.name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment