Redaguoti

Bendrinti naudojant


Compiler Warning (level 1, Error) C4368

cannot define 'member' as a member of managed 'type': mixed types are not supported

You can't embed a native data member in a managed type.

You can, however, declare a pointer to a native type and control its lifetime in the constructor and destructor and finalizer of your managed class. For more information, see Destructors and finalizers.

This warning is always issued as an error. Use the warning pragma to disable C4368.

Example

The following sample generates C4368.

// C4368.cpp
// compile with: /clr /c
struct N {};
ref struct O {};
ref struct R {
    R() : m_p( new N ) {}
    ~R() { delete m_p; }

   property N prop;   // C4368
   int i[10];   // C4368

   property O ^ prop2;   // OK
   N * m_p;   // OK
};