Skip to content

Instantly share code, notes, and snippets.

@VienosNotes
Created November 28, 2011 04:17
Show Gist options
  • Save VienosNotes/1399084 to your computer and use it in GitHub Desktop.
Save VienosNotes/1399084 to your computer and use it in GitHub Desktop.
use v6;
class T {
has $.with_accessor;
has $!without_accessor;
method new ($i as Int) {
self.bless(*, with_accessor => $i, without_accessor => $i);
}
method say_attr {
say "with: $!with_accessor";
say "without: $!without_accessor";
}
}
my $t = T.new(1);
$t.say_attr;
# 実行結果
#
# perl6 class.pl
# with: 1
# Use of uninitialized value in string context
# without:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment