条款41:了解隐式接口和编译期多态
Understand implicit interfaces and compile-time polymorphism.
运行期多态和编译期多态:
编译期决定哪个重载函数该被调用;
运行期决定哪个 virtual 函数该被绑定;
显式接口和隐式接口:
显式接口由函数的签名式(函数名称、参数类型、返回类型)构成;
隐式接口不基于函数的签名式,它由有效表达式(valid expressions)组成;
对 template 参数而言,接口是隐式的(implicit),基于有效表达式。多态则是通过 template 具现化和函数重载解析发生于编译期。
Last updated
Was this helpful?