หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
cannot apply sizeof to managed or WinRT type 'class'
The sizeof operator gets the value of an object at compile time. The size of a managed or WinRT class, interface, or value type is dynamic and so cannot be known at compile time.
For example, the following sample generates C2847:
// C2847.cpp
// compile with: /clr
ref class A {};
int main() {
A ^ xA = gcnew A;
sizeof(*xA); // C2847 cannot use sizeof on managed object
}