摘要:
条款49:了解new-handle的行为 Understand the behavior of the new-handler. operator new:分配例程; operator delete:归还例程。 new-handler:operator new无法满足客户的内存需求时所调用的函数。 阅读全文
摘要:
运行时类型识别(run-time type idenfitication,RTTI)的功能由2个运算符实现: 1)typeid,用于返回表达式的类型; 2)dynamic_cast,用于将base class pointer(或reference)安全转型为derived class pointer 阅读全文
摘要:
条款18:让接口容易被正确使用,不易被误用 Make Interfaces easy to use correctly and hard to use incorrectly. 如果想要开发一个“容易被正确使用,不容易被误用”的接口,考虑客户可能犯什么样的错误呢? 假设用一个用来表现日期的class 阅读全文