I am currently working on a project in C++. In short, I have 3 classes and a main.cpp file .
1) List class //uses a vector 2) Heap class 3) Tree Class //BST
To organize myself properly, I split each class up into separate files, namely a .hpp and .cpp file.
Of course to access all the functions in each class in my main.cpp file, I #included all three .hpp files.
Everything was working cohesively until I #included the “List.hpp” file in the “heap.hpp” and the “Tree.hpp”.
What’s weird is there was no error that showed up when I only #included the “List.hpp” in a single separate header file like “heap.hpp”.
But when I #included “List.hpp” into both for some reason methods that worked in the past don’t work anymore.
Only the methods which relied on “List” as a parameter don’t work anymore (they just don’t return anything).
I’m sure not why this happened. It’s the second time it’s happened to me and I’d like to know why so I don’t make the mistake int the future.