If C++/C were real languages for real programming they'd enforce this in the compiler.
No sane language designer would say "it is imperative that you do not implement your class in its header file" then write a compiler designer to say "oh you implemented your code in the header file? lol lmao that rocks"
I actually like how much freedom C++ gives you. As long as it is fed valid code, it does not give a fuck about how you choose to structure your project
That freedom becomes misery on the instant you have to start maintain the code from some other free spirit, whose style is totally different from yours.
If C++/C were real languages for real programming they'd enforce unreadability in the compiler.
No sane language designer would say "It is imperative that you write the most unreadable code possible" then write a compiler that says "oh your code doesn't triple dereference pointers? lol lmao that rocks"
There is an issue with templated code where the implementation does have to be in the header as well, though that is not the case here. C++20 introduced modules which I guess were meant to sort out this mess, but it has been a rocky road getting them to be supported by compilers.
The reason is that header files are pretty much copy/pasted into your c files when you include them. so the code in them keeps getting recompiled for every c file, which drastically increases overall build times. If you only declare in the header and have one c file implementing the functions you compile them only once.
pretty sure the meme is about how the implementation looks ugly but using the implementation looks good because all the code is abstracted away. if it was like you said then why would they compare the code to the main.cpp
Yeah that's why you're supposed to use header guards... If you don't and include your header in multiple places your program straight up won't compile.