I am trying to write a class to use in a program. However i am having difficulty in knowing where to place this class data -separate from main of course. Do i put it inside a header file and include it, then i can make instances? Is there room for only one .cpp file in a program and the rest are included headers?
Breaking a project out into multiple files essentially becomes a necessity as the project size increases, but it's not an enforced necessity. If you're new to programming and working on small projects, it's fine to start out with everything in the same .cpp file.
You can have multiple cpp files linked together so you can declare the class in a header, implement its functions in a *.cpp and use it in your main cpp file
Ok, so i have my main.cpp, which includes its functions inside its main.h. I have say a timer class which is prototyped in Timer.h. From there i have Timer.cpp which fleshes out the bodies of any functions declared in Timer.h.
Next picky question is, since i am declaring the function bodies outside of the actual declaration in the header, i use the notation Class::Function. My problem is that i don't know where to place the return type: e.g. Timer:: bool Start(){ .. } it does not like. How do i apply my return type?