Created
April 14, 2016 12:29
-
-
Save ufobat/5d212eed9e7835e75ee6b7b85a5e6f98 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
martin@thetis ~/.workspace/p6/Creator | |
% cat CreatorOfHuman.pm6 | |
use v6; | |
use Human; | |
role CreatorOfHuman { | |
method create_human(Str $name) { | |
return Human.new(:$name); | |
} | |
} | |
martin@thetis ~/.workspace/p6/Creator | |
% cat God.pm6 | |
use v6; | |
use CreatorOfHuman; | |
class God is CreatorOfHuman { | |
has $.might = 1; | |
} | |
martin@thetis ~/.workspace/p6/Creator | |
% cat Human.pm6 | |
use v6; | |
use CreatorOfHuman; | |
class Human is CreatorOfHuman { | |
has $.name = "Jane Doe"; | |
} | |
martin@thetis ~/.workspace/p6/Creator | |
% perl6 -I. -e 'use God; my $god = God.new' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment