Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
cannot apply sizeof to managed or WinRT type 'class'
Remarks
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.
Example
For example, the following example 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
}