程嶏清单14-14.txt

来自「< linux网络编程工具>>配套源码」· 文本 代码 · 共 23 行

TXT
23
字号
# The Coffee.pm file to illustrate inheritance.
 package Coffee;
 require Exporter;
 require Bean;
 @ISA = qw(Exporter, Bean);
 @EXPORT = qw(setImports, declareMain, closeMain);
 sub setCoffeeType  # set item
 {
     my ($class,$name) = @_;
     $class->{'Coffee'} = $name;
     print "Set coffee type to $name \n";
}
sub new  # constructor
{
    my $type = shift;
    my $this = Bean->new(); ##### <- LOOK HERE!!! ####
    $this->{'Coffee'} = 'Instant'; # unless told otherwise
    bless $this, $type;
    return $this;
}
1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?