I'm working on a project for school and the instructor insists that all code go into one .cpp file (for easier grading on his part). I would like to define multiple classes within this file. Will I run into any problems in doing this?
Yes, you can. This is easily verifiable.
class C
{
};
class D
{
};
int main(int argc, char**argv)
{
return 0;
}
There is no rule you have to follow (like in java). You're free to place and name classes in however named files you like (besides the suffix).
However its another question if that is good practices (its not!).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With