Share via


編譯器錯誤 C2549

使用者定義轉換不可以指定傳回型別

下列範例會產生 C2549:

// C2549.cpp
// compile with: /c
class X {
public:
   int operator int() { return value; }   // C2549

   // try the following line instead
   // operator int() { return value; }
private:
   int value;
};