Multiple classes in one .cpp file

I was wondering if bad practice has multiple classes in a single .cpp file. I have a background in Objective-C where this is rarely done.

+5
source share
2 answers

It makes less readable code because usually you expect the class definition to be in the header with the same name and implementation in the implementation file with the same name.

In practice, there are cases when a class is relatively small, and closely related small classes can be grouped together, but this is in each case.

+11
source

As another answer points out, it makes less readable code.

It is also important to consider the scope of the nested class:

. . , , , , .

0

All Articles