I'm trying to create a Blackjack simulator. I need to shuffle the deck before dealing cards to both the player and the dealer. shuffleDeck
is a void function and dealCard
is of type Card within class Deck
. Class Card
stores the cards that are dealt from the class Deck
. At the very beginning of the game, I need to deal two cards to both the player and the dealer.
When I tried to access the member function of Deck
in class Game
, I got the error message "Call to non-static member function without an object argument". What is the correct way for calling member functions? I'm really confused by the syntax.
void Game::deal()
{
// shuffle deck
// deal two cards to the player and two to the dealer
Deck::shuffleDeck();
Player::acceptCard (Deck::dealCard());
}