Program Structure

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?

Confused.
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?

Thanks
a very good question iam new to c++ oop programming but i will
try to help you
TYPE CLASS::MEMBER( ARGS, ... ) { IMP }

 
bool Timer::Start() { /*...*/ }
i could explain the chapter of classes in a very good way
if you want to understand it

but you can take this link it is very good ab d helpful know what you want about classes
http://www.codersource.net/cpp_tutorial_class.html

@seymore
i don't understand your code could you explain it more ?

Topic archived. No new replies allowed.