struct A{ int x, y; };
struct B{ int x, y; };
struct C{ int x, y; };
struct C{ int x, y, z; };
名字等价:
A和B是两个不同的类型,C和D是两个相同的类型(编译器会报重复定义)
布局相容:
A和B是两个不同的类型,但是他们之间是可以做显示转换的。B *pB = reinterpret_cast<A*>(pA),这样的转换是允许的。
2010-12-17
struct A{ int x, y; };
struct B{ int x, y; };
struct C{ int x, y; };
struct C{ int x, y, z; };
名字等价:
A和B是两个不同的类型,C和D是两个相同的类型(编译器会报重复定义)
布局相容:
A和B是两个不同的类型,但是他们之间是可以做显示转换的。B *pB = reinterpret_cast<A*>(pA),这样的转换是允许的。
2010-12-17