Include .cpp instead of header(.h)

后端 未结 4 1208
南旧
南旧 2020-12-28 16:46

There are some cases when we include .cpp file instead of standard header file (.h), for example:

#include \"example.cpp\"

instead of

4条回答
  •  有刺的猬
    2020-12-28 17:40

    It's lazy coding. Use header files. Yes they can increase compile time but they mean that you can easily re-implement chunks of your code, or better yet, another developer could at anytime. The header file serves as a template for what your C/C++ code is going to do. It's a bad idea to discard or ignore it.

提交回复
热议问题