C++ source files and headers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++ source files and headers

If I have too many functions inside my main source file (main.cpp) and I want to put some functions into another source file (other.cpp), then include the headers in both main.cpp and other.cpp, is this better or putting everything in 1 main.cpp is enough? Provided class is forbidden in this project. other.h void myfunction(); other.cpp #include "other.h" void myfunction() { codes } main.cpp #include "other.h" int main() { myfunction(); }

13th Jun 2019, 10:47 PM
Pomelo
0 Answers