Next | February 2001 | Slide #8 |
use Person;
$hamlet = Person->new(); $hamlet->set_name('Hamlet'); $hamlet->set_age(24);
print $hamlet->get_name, "'s age is", $hamlet->get_age, "\n";
Person->new() is like Person::new('Person')
new does not need to be exported
Person->new tells Perl which new function to call
Person->new is expected to construct a Person object and return it
We will see the internals of Person::new later
Objects are scalars
Next | ![]() |
Copyright © 2001 M-J. Dominus |