Imported Robodoc.
[robodoc.git] / Examples / PerlExample / Source / Box / RectangularBox.pm
1 #!/usr/bin/perl -w
2
3 #****c* Box/RectangularBox
4 # FUNCTION
5 #   A box with the property that are sides are equal.
6 # ATTRIBUTES
7 #   DEPTH  -- the depth of the box.
8 #   HEIGHT -- the height of the box.
9 #   WIDTH  -- the width of the box.
10 # DERIVED FROM
11 #   Box
12 #******
13
14 package RectangularBox;
15
16 use Box;
17 use vars ('@ISA');
18 @ISA = ("Box");
19
20 sub new {
21     my $classname = shift;
22     my $self      = $classname->SUPER::new(@_);
23     $self->{DEPTH}  = 1;
24     $self->{HEIGHT} = 1;
25     $self->{WIDTH}  = 1;
26     return $self;
27 }
28
29 #****m* Box/RectangularBox::volume
30 # FUNCTION
31 #   Compute the volume of the rectangular box.
32 # SYNOPSIS
33 #   my $volume = $boxref->volume();
34 # RETURN VALUE
35 #   The volume of the box
36 # SOURCE
37
38 sub volume {
39     my $self = { };
40     return $self->{DEPTH} * $self->{HEIGHT} * $self->{WIDTH};
41 }
42
43 #*****
44
45 1;
46
47