摘要:因为其他的事情耽误了看书,现在将看的笔记记录下来。1 class GameCharacter {2 public:3 virtual int healthValue() const;4 }; 1. 藉由Non-Virtual Interface 手法实现 Template Meth...
阅读全文
03 2015 档案
摘要:因为其他的事情耽误了看书,现在将看的笔记记录下来。1 class GameCharacter {2 public:3 virtual int healthValue() const;4 }; 1. 藉由Non-Virtual Interface 手法实现 Template Meth...
阅读全文
摘要:今天看了《Effective C++》中的条款33,看得十分有趣。明白了以前为啥会出现那种这种问题,原来是C++中名称遮掩规则呀。具体内容见下面文章吧。1. derived class 作用域被嵌套在base class作用域内,如下面这个例子 1 class Base { 2 ...
阅读全文
摘要:这个章节,读了两遍还是不是很清楚,有一种没法和作者沟通的感觉,看来我还是一个C++的初学者呀。好吧,不多说了,回归主题,今天的笔记。 章节一开始就弄了个例子来说明文件间的编译依存关系以及串联的依存关系。代码如下: 1 #include 2 #include"date.h" 3 #in...
阅读全文
摘要:Effective C++ 阅读笔记_条款27 尽量少做转型动作1.转型的三种形式,可以分为两大类。 (1)旧式转型(old-style casts) (1.1) (T) expresstion (1.2) T (expression)(2) 新式转型(c++-styl...
阅读全文
摘要:1 // lib中的swap 2 namespace std { 3 template 4 void swap (T& a, T& b) 5 { 6 T temp(a); 7 a = b; 8 b = tem...
阅读全文
|