Next | February 2001 | Slide #9 |
use Person;
$hamlet = Person->new(); $hamlet->set_name('Hamlet'); $hamlet->set_age(24);
print $hamlet->get_name, "'s age is", $hamlet->get_age, "\n";
$hamlet->set_name('Hamlet') calls a method
Because $hamlet is a Person object, it calls Person::set_name
It's equivalent to Person::set_name($hamlet, 'Hamlet')
We will see the internals of Person::set_name later
Next | ![]() |
Copyright © 2001 M-J. Dominus |