Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.55 KB | None | 0 0
  1. martin@thetis ~/.workspace/p6/Creator
  2.  % cat CreatorOfHuman.pm6
  3. use v6;
  4.  
  5. use Human;
  6.  
  7. role CreatorOfHuman {
  8.     method create_human(Str $name) {
  9.         return Human.new(:$name);
  10.     }
  11. }
  12. martin@thetis ~/.workspace/p6/Creator
  13.  % cat God.pm6
  14. use v6;
  15.  
  16. use CreatorOfHuman;
  17.  
  18. class God {
  19.     has $.might = 1;
  20. }
  21. martin@thetis ~/.workspace/p6/Creator
  22.  % cat Human.pm6
  23. use v6;
  24.  
  25. use CreatorOfHuman;
  26.  
  27. class Human is CreatorOfHuman {
  28.     has $.name = "Jane Doe";
  29. }
  30. martin@thetis ~/.workspace/p6/Creator
  31.  % perl6 -I. -e 'use God; my $god = God.new'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement