Content deleted Content added
Disambiguated: heap → heap (data structure), stack → stack (abstract data type) |
→Perl: Applied consistent indentation to code sample. |
||
Line 406:
# constructor
sub new {
▲ my $class = shift;
# constructor are key => value pairs
▲ # check if the arguments to the
▲ unless (@_ % 2 == 0);
▲ # default arguments
▲ my %defaults;
unless ($obj->{first_name} and $obj->{last_name});
▲ # check for required arguments
# any custom checks of data
▲ die "Need first_name and last_name for Person"
}
bless $obj,
▲ # return object blessed into Person class
}
1;
|