思维导图备注

Effective C++
首页 收藏书籍 阅读记录
  • 书签 我的书签
  • 添加书签 添加书签 移除书签 移除书签

Item 19: 视类设计为类型设计

浏览 7 扫码
  • 小字体
  • 中字体
  • 大字体
2022-02-19 19:53:08
请 登录 再阅读
上一篇:
下一篇:
  • 书签
  • 添加书签 移除书签
  • Perface(前言)
  • Introduction(导言)
  • Item 1: 将 C++ 视为 federation of languages(语言联合体)
  • Item 2: 用consts, enums和inlines取代#defines
  • Item 3: 只要可能就用 const
  • Item 4: 确保 objects(对象)在使用前被初始化
  • Item 5: 了解 C++ 为你偷偷地加上和调用了什么函数
  • Item 6: 如果你不想使用 compiler-generated functions(编译器生成函数),就明确拒绝
  • Item 7: 在 polymorphic base classes(多态基类)中将 destructors(析构函数)声明为 virtual(虚拟)
  • Item 8: 防止因为 exceptions(异常)而离开 destructors(析构函数)
  • Item 9: 绝不要在 construction(构造)或 destruction(析构)期间调用 virtual functions(虚拟函数)
  • Item 10: 让 assignment operators(赋值运算符)返回一个 reference to *this(引向 *this 的引用)
  • Item 11: 在 operator= 中处理 assignment to self(自赋值)
  • Item 12: 拷贝一个对象的所有组成部分
  • Item 13: 使用对象管理资源
  • Item 14: 谨慎考虑资源管理类的拷贝行为
  • Item 15: 在资源管理类中准备访问裸资源(raw resources)
  • Item 16: 使用相同形式的 new 和 delete
  • Item 17: 在一个独立的语句中将 new 出来的对象存入智能指针
  • Item 18: 使接口易于正确使用,而难以错误使用
  • Item 19: 视类设计为类型设计
  • Item 20: 用 pass-by-reference-to-const(传引用给 const)取代 pass-by-value(传值)
  • Item 21: 当你必须返回一个对象时不要试图返回一个引用
  • Item 22: 将数据成员声明为 private
  • Item 23: 用非成员非友元函数取代成员函数
  • Item 24: 当类型转换应该用于所有参数时,声明为非成员函数
  • Item 25: 考虑支持不抛异常的 swap
  • Item 26: 只要有可能就推迟变量定义
  • Item 27: 将强制转型减到最少
  • Item 28: 避免返回对象内部构件的“句柄”
  • Item 29: 争取异常安全(exception-safe)的代码
  • Item 30: 理解 inline 化的介入和排除
  • Item 31: 最小化文件之间的编译依赖
  • Item 32: 确保 public inheritance 模拟 "is-a"
  • Item 33: 避免覆盖(hiding)“通过继承得到的名字”
  • Item 34: 区分 inheritance of interface(接口继承)和 inheritance of implementation(实现继承)
  • Item 35: 考虑可选的 virtual functions(虚拟函数)的替代方法
  • Item 36: 绝不要重定义一个 inherited non-virtual function(通过继承得到的非虚拟函数)
  • Item 37: 绝不要重定义一个函数的 inherited default parameter value(通过继承得到的缺省参数值)
  • Item 38: 通过 composition(复合)模拟 "has-a"(有一个)或 "is-implemented-in-terms-of"(是根据……实现的)
  • Item 39: 谨慎使用 private inheritance(私有继承)
  • Item 40: 谨慎使用 multiple inheritance(多继承)
  • Item 41: 理解 implicit interfaces(隐式接口)和 compile-time polymorphism(编译期多态)
  • Item 42: 理解 typename 的两个含义
  • Item 43: 了解如何访问 templatized base classes(模板化基类)中的名字
  • Item 44: 从 templates(模板)中分离出 parameter-independent(参数无关)的代码
  • Item 45: 用 member function templates(成员函数模板) 接受 "all compatible types"(“所有兼容类型”)
  • Item 46: 需要 type conversions(类型转换)时在 templates(模板)内定义 non-member functions(非成员函数)
  • Item 47: 为类型信息使用 traits classes(特征类)
  • Item 48: 感受 template metaprogramming(模板元编程)
  • Item 49: 了解 new-handler 的行为
  • Item 50: 领会何时替换 new 和 delete 才有意义
  • Item 51: 编写 new 和 delete 时要遵守惯例
  • Item 52: 如果编写了 placement new,就要编写 placement delete
  • Item 53: 不要轻忽编译器的警告
  • 条款 54: 让自己熟悉包括TR1在内的标准程序库
  • 条款55:让自己熟悉Boost
  • Terminology(术语)
  • 附录 A. 超越 Effective C++
  • 附录 B. 第二和第三版之间的 Item 映射
暂无相关搜索结果!
    展开/收起文章目录

    二维码

    手机扫一扫,轻松掌上学

    《Effective C++》电子书下载

    请下载您需要的格式的电子书,随时随地,享受学习的乐趣!
    EPUB 电子书

    书签列表

      阅读记录

      阅读进度: 0.00% ( 0/0 ) 重置阅读进度