10 面向对象思考

尚未进行身份认证

暂无相关简介

等级
TA的排名 4k+

c++核心准则C.137: 使用虚基类避免过于一般的基类‍

C.137: Usevirtualbases to avoid overly general base classesC.137: 使用虚基类避免过于一般的基类‍Reason(原因)Allow separation of shared data and interface. To avoid all shared data to being put into an ultim...

2020-04-06 20:08:10

C++核心准则C.136:使用多重继承表现“实现属性”的组合

C.136: Use multiple inheritance to represent the union of implementation attributesC.136:使用多重继承表现“实现属性”的组合。‍Reason(原因)Some forms of mixins have state and often operations on that state....

2020-04-05 19:17:54

C++核心准则C.135:使用多重继承表现多个不同种类的接口‍

C.135: Use multiple inheritance to represent multiple distinct interfacesC.135:使用多重继承表现多个不同种类的接口‍Reason(原因)Not all classes will necessarily support all interfaces, and not all callers w...

2020-04-04 19:53:53

C++核心准则C.134:确保所有非常量数据成员具有相同的访问权限‍

C.134: Ensure all non-constdata members have the same access levelC.134:确保所有非常量数据成员具有相同的访问权限‍Reason(原因)Prevention of logical confusion leading to errors. If the non-constdata members ...

2020-04-03 18:52:53

C++核心准则C.133:避免保护型数据成员‍

C.133: Avoid protected dataC.133:避免保护型数据成员‍Reason(原因)protected data is a source of complexity and errors.protected data complicates the statement of invariants.protected data inherently vi...

2020-04-02 18:42:47

C++核心准则C.132:不要没有理由就将函数声明为虚函数‍

C.132: Don't make a functionvirtualwithout reasonC.132:不要没有理由就将函数声明为虚函数‍Reason(原因)Redundantvirtualincreases run-time and object-code size. A virtual function can be overridden and is thus...

2020-04-01 19:11:22

C++核心准则C.131: 避免无意义的getters和setters‍

C.131: Avoid trivial getters and settersC.131: 避免无意义的getters和setters‍Reason(原因)A trivial getter or setter adds no semantic value; the data item could just as well be public.无意义的getter和sette...

2020-03-31 18:47:40

C++核心准则C.130:实现多态类的深拷贝时,虚clone函数要比拷贝构造函数/赋值运算符好

C.130: For making deep copies of polymorphic classes prefer a virtual clone function instead of copy construction/assignmentC.130:实现多态类的深拷贝时,虚clone函数要比拷贝构造函数/赋值运算符好。‍Reason(原因)Copying a polym...

2020-03-30 18:33:03

C++核心准则C.129:设计类层次关系时,区分实现继承和接口继承‍

C.129: When designing a class hierarchy, distinguish between implementation inheritance and interface inheritanceC.129:设计类层次关系时,区分实现继承和接口继承‍ ...

2020-03-29 18:08:25

永远无法在游泳池里学会海战--《实战Python设计模式》新书介绍

《实战Python设计模式:实战Python设计模式:可复用面向对象软件开发实践》是本人根据自己在实际开发工作中积累的有关Python语言,设计模式的经验,想法写成的一本书,由电子工业出版社出版。谨此推荐给各位。作为可复用面向对象软件开发的基础,设计模式集合了很多软件开发领域专家的宝贵经验和良好实践,其重要性不言而喻。但是,学习设计模式的过程并不是一帆风顺的,对于缺乏面向对象开发经验的设计者...

2020-03-29 09:58:38

C++核心准则C.128:虚函数应该明确定义为virtual,overide或者final

C.128: Virtual functions should specify exactly one of virtual, override, or finalC.128:虚函数应该明确定义为virtual,overide或者finalReason(原因)Readability. Detection of mistakes. Writing explicit virtu...

2020-03-28 18:14:06

C++核心准则C.127:包含虚函数的类应该有虚析构函数或保护析构函数‍

C.127: A class with a virtual function should have a virtual or protected destructorC.127:包含虚函数的类应该有虚析构函数或保护析构函数‍Reason(原因)A class with a virtual function is usually (and in general) used via...

2020-03-27 16:27:17

C++核心准则C.126:抽象类通常不需要构造函数‍

C.126: An abstract class typically doesn't need a constructorC.126:抽象类通常不需要构造函数‍Reason(原因)An abstract class typically does not have any data for a constructor to initialize.抽象类通常不包含任何需要构造函数...

2020-03-26 16:42:22

C++核心准则C.122:需要完全隔离接口和实现时用抽象类作为接口‍

C.122: Use abstract classes as interfaces when complete separation of interface and implementation is neededC.122:需要完全隔离接口和实现时用抽象类作为接口‍Reason(原因)Such as on an ABI (link) boundary.类似AB...

2020-03-25 18:44:26

C++核心准则C.121:如果基类被用来定义接口,保证它是一个纯虚类‍

C.121: If a base class is used as an interface, make it a pure abstract classC.121:如果基类被用来定义接口,保证它是一个纯虚类‍Reason(原因)A class is more stable (less brittle) if it does not contain data. Interf...

2020-03-24 18:21:03

C++核心准则C.120:类层次体系只用于表现固有的阶层结构‍

C.120: Use class hierarchies to represent concepts with inherent hierarchical structure (only)C.120:类层次体系只用于表现固有的阶层结构‍Reason(原因)Direct representation of ideas in code eases comprehension a...

2020-03-23 18:42:01

C++核心准则C102-109:容器的基本要求

C.102: Give a container move operationsC.102:为容器实现移动操作‍Reason(原因)Containers tend to get large; without a move constructor and a copy constructor an object can be expensive to move around, ...

2020-03-22 17:54:53

C++核心准则C.101:赋予容器值语义‍

C.101: Give a container value semanticsC.101:赋予容器值语义‍Reason(原因)‍Regular objects are simpler to think and reason about than irregular ones. Familiarity.常规对象相比非常规对象更容易理解和思考。这是亲和度方面的意义。...

2020-03-21 18:01:45

C++核心准则C.100:定义容器时遵从STL标准‍

C.100: Follow the STL when defining a containerC.100:定义容器时遵从STL标准‍Reason(原因)The STL containers are familiar to most C++ programmers and a fundamentally sound design.STL容器被大多数程序员...

2020-03-20 18:33:00

C++核心准则C.90:依靠构造函数和赋值运算符,而不是内存初始化和内存拷贝‍

C.90: Rely on constructors and assignment operators, not memset and memcpyC.90:依靠构造函数和赋值运算符,而不是内存初始化和内存拷贝‍Reason(原因)The standard C++ mechanism to construct an instance of a type is to c...

2020-03-19 18:34:50

查看更多

CSDN身份
  • 博客专家
勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 1024勋章
    1024勋章
    #1024程序员节#活动勋章,当日发布原创博客即可获得
  • 勤写标兵Lv3
    勤写标兵Lv3
    授予每个自然周发布7篇到8篇原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。