c++ - §1.3.7 (N4140) 中是否缺少 `polymorphic` 一词?

标签 c++ polymorphism language-lawyer

polymorphic 一词(在括号中)不是在§1.3.7 动态类型 中吗?

[ Example: if a pointer (8.3.1) p whose static type is “pointer to class B” is pointing to an object of a (polymorphic) class D, derived from B (Clause 10), the dynamic type of the expression *p is “D.” References (8.3.2) are treated similarly. —end example ]

最佳答案

首先,即使我们想在这种情况下要求多​​态性,将该要求强加给 B 类而不是 D 会更有意义(因此D 也会变成多态的)。

其次,动态类型的一般概念不以任何方式依赖于多态性。

关于c++ - §1.3.7 (N4140) 中是否缺少 `polymorphic` 一词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31683281/

相关文章:

java - ArrayList和List接口(interface)多态?

C++继承: Pass sub-class to a function expecting base-class and get sub-class behaviour

c++ - 为什么仍然需要在 using 语句的 RHS 中消除依赖类型与 typename 的歧义?

带有外部 SDK 的 C++ Diamond of Doom

c++ - 默认构造函数全部封装在头文件中

c++ - 为什么后缀运算符设计为按值返回?

c++ - 如何使用 SIMD 指令使预乘 alpha 函数更快?

c++ - C++子类构造函数被忽略

c++ - 在泛型编程中使用 placement new

C++ 为什么atomic_load的参数类型是指针而不是引用?