class Produce : public Item {
...
}
class Book : public Item {
...
}
is there a way to make the Inventory class recognize Produce and Book objects ?
I have tried forward declarations, composition etc nothing works.
Thanks.
So in order for the inventory class to be recognized by the Produce and Book classes, you need to put Inventory below Produce and Book. Have you tried doing that?
Each of your class declarations should be in it's own header file (.hpp) and the implementations should be in their own .cpp files all of which are named exactly after the class name. For example Item.hpp and Item.cpp Then, #include the header file for the class you want to use, just watch out for circular includes.