Make sure you follow the rule of three when implementing a class that has pointer variables (You do in the Catalog class).
https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)
Basically states that if you need to provide your own definition for one of the following three, you need to provide your own definition for the other 2 as well.
1. Destructor
2. Copy Constructor
3. Copy Assignment
Destructor is necessary in Catalog to prevent memory leak. Copy constructor and copy assignments are necessary to prevent shallow copies.
http://stackoverflow.com/questions/184710/what-is-the-difference-between-a-deep-copy-and-a-shallow-copy
With C++11, there is rule of five, which includes Move constructor and Move Assignment. It's not absolutely necessary though.
http://en.cppreference.com/w/cpp/language/rule_of_three
Unlike Rule of Three, failing to provide move constructor and move assignment is usually not an error, but a missed optimization opportunity |
[EDIT] By the way, you need to increment numProducts whenever you add a product because as far as I can tell, int numProducts keeps track of how many products the Catalog has. Once numProducts equals maxProducts, it means the Catalog is full and user should have the option of "increasing" maxProducts or simply leave the catalog as full depending on your assignment requirements.
Also, in the Default Constructor of Catalog, you set productList as nullptr and in void addProduct, you are trying to dereference nullptr (This will crash the program). Probably better if you set a default maxProducts (Whether it be 10 or whatever arbitrary number you set) and allocate memory in your default constructor. Of course, numProducts will be 0 since default constructed catalog would not have any products added.
If you are against the idea of "default maxProducts", then make sure you check for nullptr in addProduct function before you derefence it.