1. <tfoot id='o4QyB'></tfoot>
        <bdo id='o4QyB'></bdo><ul id='o4QyB'></ul>

      <i id='o4QyB'><tr id='o4QyB'><dt id='o4QyB'><q id='o4QyB'><span id='o4QyB'><b id='o4QyB'><form id='o4QyB'><ins id='o4QyB'></ins><ul id='o4QyB'></ul><sub id='o4QyB'></sub></form><legend id='o4QyB'></legend><bdo id='o4QyB'><pre id='o4QyB'><center id='o4QyB'></center></pre></bdo></b><th id='o4QyB'></th></span></q></dt></tr></i><div id='o4QyB'><tfoot id='o4QyB'></tfoot><dl id='o4QyB'><fieldset id='o4QyB'></fieldset></dl></div>
      1. <legend id='o4QyB'><style id='o4QyB'><dir id='o4QyB'><q id='o4QyB'></q></dir></style></legend>

        <small id='o4QyB'></small><noframes id='o4QyB'>

        包含 .cpp 而不是 header(.h)

        时间:2023-08-25
        • <i id='IAh3q'><tr id='IAh3q'><dt id='IAh3q'><q id='IAh3q'><span id='IAh3q'><b id='IAh3q'><form id='IAh3q'><ins id='IAh3q'></ins><ul id='IAh3q'></ul><sub id='IAh3q'></sub></form><legend id='IAh3q'></legend><bdo id='IAh3q'><pre id='IAh3q'><center id='IAh3q'></center></pre></bdo></b><th id='IAh3q'></th></span></q></dt></tr></i><div id='IAh3q'><tfoot id='IAh3q'></tfoot><dl id='IAh3q'><fieldset id='IAh3q'></fieldset></dl></div>
            <bdo id='IAh3q'></bdo><ul id='IAh3q'></ul>
            <legend id='IAh3q'><style id='IAh3q'><dir id='IAh3q'><q id='IAh3q'></q></dir></style></legend>

              <small id='IAh3q'></small><noframes id='IAh3q'>

                <tbody id='IAh3q'></tbody>
                  <tfoot id='IAh3q'></tfoot>
                  本文介绍了包含 .cpp 而不是 header(.h)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在某些情况下,我们包含 .cpp 文件而不是标准头文件 (.h),例如:

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

                  #include "example.cpp"
                  

                  代替

                  #include "example.h"
                  

                  它似乎有效,但这是否安全还是我应该避免它?

                  It seems to work but is this safe or should I avoid it?

                  编译时间呢?

                  推荐答案

                  这是懒惰的编码.使用头文件.是的,它们可以增加编译时间,但它们意味着您可以轻松地重新实现代码块,或者更好的是,其他开发人员可以随时重新实现.头文件用作 C/C++ 代码将要执行的操作的模板.丢弃或忽略它是一个坏主意.

                  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.

                  这篇关于包含 .cpp 而不是 header(.h)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:有什么好的 C++ 项目构建工具,可以代替 make 吗? 下一篇:在 Visual Studio 中运行小型 C++ 程序而无需创建项目

                  相关文章

                1. <small id='EnkUs'></small><noframes id='EnkUs'>

                    <bdo id='EnkUs'></bdo><ul id='EnkUs'></ul>

                    1. <i id='EnkUs'><tr id='EnkUs'><dt id='EnkUs'><q id='EnkUs'><span id='EnkUs'><b id='EnkUs'><form id='EnkUs'><ins id='EnkUs'></ins><ul id='EnkUs'></ul><sub id='EnkUs'></sub></form><legend id='EnkUs'></legend><bdo id='EnkUs'><pre id='EnkUs'><center id='EnkUs'></center></pre></bdo></b><th id='EnkUs'></th></span></q></dt></tr></i><div id='EnkUs'><tfoot id='EnkUs'></tfoot><dl id='EnkUs'><fieldset id='EnkUs'></fieldset></dl></div>
                      <legend id='EnkUs'><style id='EnkUs'><dir id='EnkUs'><q id='EnkUs'></q></dir></style></legend>

                      <tfoot id='EnkUs'></tfoot>