【发布时间】:2015-10-09 04:35:32
【问题描述】:
我不能在 Perl 6 的类中调用私有方法:
class MyClass {
method !my-private-method($var1) {
# ....
}
method my-method() {
my $my-var1 = !my-private-method(123); # not found (Undeclared routines)
my $my-var1 = $!my-private-method(123); # not found (Undeclared routines)
my $my-var1 = $.my-private-method(123); # not found (Undeclared routines)
my $my-var1 = my-private-method(123); # not found (Undeclared routines)
那么我如何从my-method 呼叫my-private-method?
【问题讨论】:
-
您确定那些带有破折号的变量和方法名称吗?这有点像 COBOL……
-
@JonathanLeffler,是的。