When you are working with an IDE ("interface and code and everything") your .cpp files go in your Project list (they are not #include'd into the main), and then the class declaration goes in a .h which is #include'd into the files requiring that class (like derived requiring base).
Code:
////////main.cpp
#include "main.h"
BaseClass::BaseClass() //constructor to class from main.h
{
}
int main ()
{
}
////////main.h
class BaseClass
{
public:
BaseClass(); //constructor declared here, defined in main.cpp
};
////////derived1.cpp
#include "main.h"
class Derived1 : public BaseClass /*you could put this part in its own .h too, and include it into this .cpp file*/
{
public:
Derived1(); //constructor
};
Derived1::Derived1 ()
{
}
And your Project list would be: main.cpp, derived1.cpp, derived2.cpp, etc. If that compiles, then yah the code would be right.