Created
July 29, 2012 15:38
-
-
Save hoelzro/3199546 to your computer and use it in GitHub Desktop.
Using custom BUILD and Mu.BUILD in the same class
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; | |
class CustomObject { | |
} | |
class CustomBuild { | |
has $.foo; | |
has $.bar; | |
submethod BUILD(*%params) { | |
$!bar = CustomObject.new; | |
} | |
} | |
my $object = CustomBuild.new(:foo(17)); | |
# $object.foo should be 17, right? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment