Share via


編譯器錯誤 C2582

'function' 函式無法在 'type' 中使用

嘗試要指派沒有指派運算子的物件。

下列範例會產生 C2582:

// C2582.cpp
// compile with: /clr
using namespace System;

struct N {};
ref struct O {};
ref struct R {
   property O prop;   // C2582
   property O ^ prop2;   // OK
};

int main() {
   String ^ st1 = gcnew String("");
   ^st1 = gcnew String("");   // C2582
   st1 = "xxx";   // OK
}