I am trying to create a deck of cards by creating a "card deck" class which uses an array of 52 "card" class objects. The array needs to be dynamically allocated, but I can't figure out the syntax to create this. My code gives this error:
error C2512: 'Card' : no appropriate default constructor available
#include "CardDeck.h"
#include "Card.h"
#include <iostream>
#include <cstdlib>
using namespace std;
CardDeck::CardDeck()
{
*Deck = new Card[52];
}
I am curious as to whether I am able to create the array using my Card::Card(char a , char b) constructor, or if I must first create the array using a default constructor.
'Card' : no appropriate default constructor available- this means you don't have a constructor of the formCard::Card().