I am trying to declare a member variable that is an array of unknown size, that contains pointers to objects (objects that don't have default constructors). Additionally, I want the array to be populated with NULL pointers until I explicitly assign it. How do I do this?
Here is what I have so far (unrelated code removed):
In the .h:
class Column
{
private:
Card **_cards;
qint32 _color;
};
In the .cpp:
Column::Column( qint32 color )
:
_color( color )
{
_cards = new Card[Card::maxValue()];
}
Here are the relevant compiler errors:
error: no matching function for call to ‘Card::Card()’
error: cannot convert ‘Card*’ to ‘Card**’ in assignment