Playing cards: Difference between revisions
→{{header|Perl 6}}: "multi prefix:<~>" → "method Str". This change makes it possible to privatize the instance variables, so I did.
Underscore (talk | contribs) (Added Perl 6.) |
Underscore (talk | contribs) (→{{header|Perl 6}}: "multi prefix:<~>" → "method Str". This change makes it possible to privatize the instance variables, so I did.) |
||
Line 1,369:
class Card {
has Pip $
has Suit $
}
▲multi prefix:<~> (Card $c) { $c.pip.name ~ " of " ~ $c.suit.name }
class Deck {
has Card @
submethod BUILD {
Line 1,387:
method deal { shift @!cards }
}</lang>
Some examples of use:
|