[Interest] Two from one.

william.crocker at analog.com william.crocker at analog.com
Fri Feb 9 14:40:49 CET 2018


>
> Think about C++ classes and files. If you have 3 classes like A, B and C, it is
> common practice
> to have them defined in 3 header files in particular if they are complex
> classes, even if both B and C inherits from A.
> And hardly anyone would try to put the 3 of them in a single header file, even
> though C++ completely support having an
> arbitrary number of classes in a single file.
>

If I have a significant class that is best implemented with a number of
other insignificant, one-off classes, I am not going to give each one their own
file.

The QRegExp class implementation (5.7) is a good example.
The file qregexp.cc contains 10 helper structs. (struct is
the lazy man's class.) Development of QRegExp would not have
benefited from giving each one it's on header and source file.

Bill



More information about the Interest mailing list