In my company there is implicit rule not to define multiple classes inside one .cpp file. The argumentation is that it looks like a mess and hard to read. But in my opinion it will make sense if the classes is related and not meant to be used outside compilation unit. Example:
example.h:
class ExampleState;
class Example {
...
void SomeMethod();
private:
ExampleState* state_;
}
example.cpp:
class ExampleState {
...
}
Example::SomeMethod() {
state_ = new ExampleState();
...
}
What is your suggestion?