Novice in C++

I have posted many times questions about Java related topics. This would probably be one of my few C++ postings. The problem I am having is printing out the contents of a vector declared in a class, and inherited in other classes that need to access it. I suppose I want to know how to fix my problem, but first I need to know why the way I am doing what I am doing is not working at all. It prints nothing that I need. Here are my files

First the CardPile.cpp file. The .h files I won't include, as there is nothing extra in them that the cpp file won't show...at least I don't think there is.

These are the classes that are currently relevant to me trying to print out the values of the vector, but it doesn't work at all, or it prints garbage when I try various changes in the initDeck method. I don't know what I'm doing at all obviously, and if someone could please help me out I would much appreciate it.

When coding I recommend your write and test only a couple lines, or at most a single function, at a time. Since CardPile seems to be the first thing you wrote I'd start there. Given the constructor you posted I suspect you want CardPile to have a member that is declared as vector<Card> theDeck, in which case you declare the vector in CardPile.h, not in the constructor. In addCard you would just pass the card you want to add, and don't need to pass the cardPile. addCard is a member function so it will only be used on the cardPile that is indicated. addCard would look something like this:

I do wonder if this is still relevant to answer... An overview of the code sugests you have no idea how obejct orientation works in c++ ? For example CardPile() is pointless (it does nothing but initializes a vector and destroys it)...

If we assume that you use TheDeck as simply a holder for a vector you should be able to get something out of listCards if you actually do something more than initalizing and destroying cards in initDeck (ie add the card to the deck after you have created it), I have no idea if this is what you want but it should atleast show some results that way...