条款41 Understand implicit interfaces and compile-time polymorphism
了解隐式接口和编译器多态
class和template都支持接口和多态,而class的接口是explicit的,对于template而言,接口时implicit的。
运行期多态和编译器多态类似于绑定哪个virtual函数和使用哪个重载函数的区别。
条款42 Understand the two meanings of typename
了解typename的双重含义
声明template参数时,class与typename同义
以上代码可能会出现问题——你必须假定有C::const_iterator的这样一个类型,但我们没有告诉C++是,所以需要以下关键字:typename
typename只用来验明嵌套从属类型名称
条款43 Know how to access names in templatized base classes
学习处理模板化基类内的名称
可在 derived class templates 内通过"this->" 指涉 base class templates 内的成员名称,或藉由一个明白写出的 "base class 资格修饰符"完成。