无论如何要区分类型的原始名称和该类型的typedef-name?
例如:
class C1 {};
typedef C1 C2;
Run Code Online (Sandbox Code Playgroud)
C1和C2现在都命名相同的类型.在上述代码之后的代码中,是否有一种情况是,参考所讨论的类型的名称C1的出现不能用C2替换(反之亦然)?
A typedef creates an alias, and they are indistinguishable as a type. There are on the other hand some specific syntax constructs that require the real type and not the typedef-ed (declaration/definition of constructor/destructors...), but that is a different question. As a type they are indistinguishable.
| 归档时间: |
|
| 查看次数: |
352 次 |
| 最近记录: |