Separate files
They will most certainly always be used together so I declare them in the same file. I guess I get a bit lazy sometimes but this isn't necessarily a bad thing as an overcomplicated #include hierarchy can make using your C++ classes a pain - one of the problems with having separate files for every class declaration. One way you can reduce the number of dependancies of #includes is to use forward declarations of classes in your .h files. See Item 31 of Scott Meyers Effective C++ for a really good explanation (much better than what I could give here!).
b e n
I am actually using PHP and not C++.
Thanks for the advice. I am actually using PHP and not C++, but the concepts are most likely the same. Although I am not sure if PHP has a function similar to the one you describe for C++. The only thing I can find is the autoload function.
I am very sorry to hear that. I wish you a speedy recovery from the RSI you're going to get from typing $this-> many times.
b e n
Doesn't Java require each class to be a separate file?
Doesn't Java require each class to be a separate file?
public class Item {
//...
}
class SubItem {
//...
}