Perl里面定义函数开始都写个my $self= shift,有什么用?

日期:2017-11-27 08:14:51 人气:1

Perl里面定义函数开始都写个my $self= shift,有什么用?

类方法的第一个参数是类(包)的名字,也就是把这个类/包的名字作为第一个参数 package House; # Class2 sub new { # Class method called a constructor3 my $class = shift;4 my $ref={"Owner"=>undef, # Attributes of the object"Price" =>undef, # Values will be assigned la
    A+
热门评论