前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >C++核心准则​NR.4:不要坚持将每个类声明放在其自己的源文件中

C++核心准则​NR.4:不要坚持将每个类声明放在其自己的源文件中

作者头像
面向对象思考
发布2020-11-10 10:58:32
8800
发布2020-11-10 10:58:32
举报

NR.4: Don't insist on placing each class declaration in its own source file

NR.4:不要坚持将每个类声明放在其自己的源文件中

Reason(原因)

The resulting number of files from placing each class in its own file are hard to manage and can slow down compilation. Individual classes are rarely a good logical unit of maintenance and distribution.

将每个类放在自己的文件中而产生的文件数量很难管理,并且可能减慢编译速度。单个类很少是维护和分发的良好逻辑单元。

Example(示例)

代码语言:javascript
复制
???
Alternative(代替选项)
  • Use namespaces containing logically cohesive sets of classes and functions. 使用包含逻辑上紧密结合的类和函数组合的命名空间。

原文链接

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nr4-dont-insist-on-placing-each-class-declaration-in-its-own-source-file

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-11-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 面向对象思考 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • NR.4: Don't insist on placing each class declaration in its own source file
    • Alternative(代替选项)
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档