类型转换,static_cast还是reinterpret_cast?
class A
{
private:
int i;
};
现在要有
A* next;
next = static_cast<A*>(new char[sizeof (A*)]);//这样不行
next = reinterpret_cast<A*>(new char[sizeof (A*)]);//这样可以,好吗
...全文
44521打赏收藏
类型转换,static_cast还是reinterpret_cast?
类型转换,static_cast还是reinterpret_cast? class A { private: int i; }; 现在要有 A* next; next = static_cast(new char[sizeof (A*)]);//这样不行 next = reinterpret_cast(new char[sizeof (A*)]);//这样可以,好吗