So I've been taught to never include .cpp files in the main.cpp but instead include the .h that references that .cpp file. This has been fine as my standard .h file looks something like this:
and the screenText.cpp file holds the actual function for screenText(). In my main I would include screenText.h
Now for the question. I want to divide my player class into a separate file as to keep it nice and organized from the rest of the code (main.cpp). I have a playerClass.cpp file where I have created my class. Sticking to what I've been doing I shouldnt just #include "playerClass.cpp" on my main, but instead I should include a header file that references the playerClass.cpp, right? What would my header(.h) file look like then? As previous stated I usually just declare the function in the .h file, but not sure what to do now that its a class.
I'd like to add something to my question now that I've had some time to fiddle around. In Visual Studio I used the "Add Class" feature so it generates both the .cpp and .h
I am not sure what it's doing exactly, maybe I need more practice with classes but this is what it's given me.
player() is the constructor; it is called when an object of the class is created.
~player() is the destructor; it is called when an object of the class is deleted/deallocated.