Blackjack
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
Card Class Reference

A Card is defined by its rank (see CardRank) and suit (see CardSuit). More...

#include <card.h>

Public Member Functions

 Card (CardRank rank=rank_ace, CardSuit suit=club)
 
int getCardValue () const
 Get the value of a Card.
 
CardRank getRank () const
 Get the card's rank.
 

Friends

std::ostream & operator<< (std::ostream &out, const Card &card)
 Overload << to print a Card.
 

Detailed Description

A Card is defined by its rank (see CardRank) and suit (see CardSuit).

Constructor & Destructor Documentation

◆ Card()

Card::Card ( CardRank  rank = rank_ace,
CardSuit  suit = club 
)

Member Function Documentation

◆ getCardValue()

int Card::getCardValue ( ) const

Get the value of a Card.

Returns
int

The value of a card is the value of its rank

Returns
int

◆ getRank()

CardRank Card::getRank ( ) const

Get the card's rank.

Returns
CardRank

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const Card card 
)
friend

Overload << to print a Card.

Parameters
out
card
Returns
std::ostream&

This function is declared as a friend of Card so that we can directly access its private members: m_rank and m_suit.


The documentation for this class was generated from the following files: