Hello all,

I'm having trouble understanding how a project source files are structured. I understand when it comes to the use of classes.... I think.

An header file includes the class data members definition plus any member functions definitions I may deem appropriate to be treated as inline function members. The corresponding source file includes this header and defines all other function members. When I need to reuse this class, I add both files to my project and include the header file on any source file that declares an object of that class. So...

Code:
---------- myClass.h ---------------
#ifndef MYCLASS_H
#define MYCLASS_H

class myClass {
    int a;
public:
    void seta(int x);
    int geta() { return a; };
};
#endif

--------- myClass.cpp --------------
#include "myClass.h"

void myClass::seta(int x) {
    a = x;
}

------------ main.cpp ---------------
#include "myClass.h"

int main()
{
    /*.......*/
}
But what then when my main.cpp file grows too large and I start considering breaking it? I have a minimal understanding of function prototypes. I'm afraid Addison Wesley's C++ Primer 4th Edition, being otherwise an excellent book, fails to clearly explain this concept.

When do I need to prototype a function? Why? And where? To ease your explanation, let's imagine my main.cpp has a couple of functions I want to move to a source file of their own. int doThis(int x) and void doThat(int x).

Thanks for your time.