📄 rectangularbox.pm
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -