rectangularbox.pm
来自「编程工具:直接从程序代码中的注释 产生软件的文档」· PM 代码 · 共 48 行
PM
48 行
#!/usr/bin/perl -w
#****c* Box/RectangularBox
# FUNCTION
# A box with the property that are sides are equal.
# ATTRIBUTES
# DEPTH -- the depth of the box.
# HEIGHT -- the height of the box.
# WIDTH -- the width of the box.
# DERIVED FROM
# Box
#******
package RectangularBox;
use Box;
use vars ('@ISA');
@ISA = ("Box");
sub new {
my $classname = shift;
my $self = $classname->SUPER::new(@_);
$self->{DEPTH} = 1;
$self->{HEIGHT} = 1;
$self->{WIDTH} = 1;
return $self;
}
#****m* Box/RectangularBox::volume
# FUNCTION
# Compute the volume of the rectangular box.
# SYNOPSIS
# my $volume = $boxref->volume();
# RETURN VALUE
# The volume of the box
# SOURCE
sub volume {
my $self = { };
return $self->{DEPTH} * $self->{HEIGHT} * $self->{WIDTH};
}
#*****
1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?