use Cards;
my $card = Cards->new( suit => 'H',
name => 'Q' );
$card->set_face("back");
$card->set_suit("D");
$card->print;
foreach $i (2..9) {
push @deck, Cards->new ( suit => 'D', name => $i);
}
foreach (@deck) { $_->print; }
$card is a reference to something
Inside the module it can be a ref-to-array, a ref-to-hash, a ref-to-scalar, etc.
The user of the module doesn't know, and shouldn't care. (encapsulation)
Each element of @deck is a different instance.
Cards can be based on another OO module (inheritance)
|