# Stats2.pm
# Derived "Stats" with some functionalities added

package Stats2;

@ISA = ('Stats');	# inherits Stats
use Stats;

# Note that by using the 2-argument form of 
# bless() the constructor can also be inherited

# Override addValue()
sub addValue {
	my ($this, $num) = @_;
	if (!defined $this->{'min'}) {
		$this->{'min'} = $num;
		$this->{'max'} = $num;
	} else {
		$this->{'min'} = ($num < $this->{'min'})?$num:$this->{'min'};
		$this->{'max'} = ($num > $this->{'max'})?$num:$this->{'max'};
	}
	# invoke the base class version of addValue()
	$this->SUPER::addValue($num);	# OR $this->Stats::addValue($num)
}

# Find minimum
sub getMinimum {
	my $this = $_[0];
	return $this->{'min'};
}

# Find maximum
sub getMaximum {
	my $this = $_[0];
	return $this->{'max'};
}

1;
