共用方式為


編譯器錯誤 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
}