All pastes #373174 Raw Edit

Stuff

public text v1 · immutable
#373174 ·published 2007-02-26 16:31 UTC
rendered paste body
package Parent;

our $thing;


sub new {
        my ($class) = @_;
        my $self = { };
        return bless($self, $class);
}

sub thing {
        my ($self, $x) = @_;
        if ($x) {
                $thing = $x;
        }
        return $x;
}

---------------------------------------------
package Child;

use base 'Parent';


-----------------------------------------
script

use Child;

my $obj = Child->new();

$obj->thing('bovine juice');
print $obj->thing, "\n";