File: RectangularBox.pm

package info (click to toggle)
robodoc 4.99.40-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,560 kB
  • ctags: 978
  • sloc: ansic: 14,067; sh: 3,711; perl: 155; makefile: 108
file content (47 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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;