托管C++(以下简称C++/CLI)兼容标准C++的数据类型,在托管类内定义这些数据类型将转换为另一中形式。
public __gc class Test
{
// TODO: 在此添加此类的方法。
private:
bool m_bool;
int m_int;
long m_long;
char m_char;
short m_short;
float m_float;
double m_double;
unsigned int m_unsigned_int;
unsigned long m_unsigned_long;
unsigned char m_unsigned_char;
unsigned short m_unsigned_short;
};
使用Reflector反编译的代码:
public __gc class Test
{
// Methods
public: Test();
// Fields
private: Boolean __gc* m_bool;
private: SByte __gc* modopt(NoSignSpecifiedModifier __gc*) m_char;
private: Double __gc* m_double;
private: Single __gc* m_float;
private: Int32 __gc* m_int;
private: Int32 __gc* modopt(IsLongModifier __gc*) m_long;
private: Int16 __gc* m_short;
private: Byte __gc* m_unsigned_char;
private: UInt32 __gc* m_unsigned_int;
private: UInt32 __gc* modopt(IsLongModifier __gc*) m_unsigned_long;
private: UInt16 __gc* m_unsigned_short;
};