Created
March 27, 2022 15:52
-
-
Save gfldex/eb28b4d6f21acbd62296d9ae699f9a68 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
use v6.d; | |
class A { | |
has $!a = 'private'; | |
method !a { $!a } | |
} | |
multi sub trait_mod:<is>(Mu:U \obj, :$spying!) { | |
A.^add_trustee(obj); | |
A.^compose; | |
} | |
class B is spying(A) { | |
has A $.a = A.new; | |
method m { say $!a!A::a } | |
} | |
B.new.m; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment