Calling a class from a class?

I'm working on a card game program. I have a class called Deck and a class called Card

I'm trying to do something like this:
1
2
3
4
5
6
7
class Deck
{
    private:
    Card cards[52];
    
    // ...
};
But this doesn't work. How am I supposed to create/call a class in a class then?

Thanks!
Does the definition of Card appear before the definition of Deck?

EDIT: v Hoho! Hive mind!
Last edited on
That should work just fine.

So long as Card is prototyped before Deck.

And if Card has a default constructor.

Hope this helps.
Thanks. I didn't realize order mattered. I would've assumed the compiler would've run through all the classes and add it to some sort of list that it would reference, then do the actual compiling...
Topic archived. No new replies allowed.