Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created November 30, 2016 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/fafbdd1035fa7219c4c8f9c3bb108edc to your computer and use it in GitHub Desktop.
Save zoffixznet/fafbdd1035fa7219c4c8f9c3bb108edc to your computer and use it in GitHub Desktop.
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