컴파일러 오류 CS0562
업데이트: 2007년 11월
오류 메시지
단항 연산자의 매개 변수는 포함하는 형식이어야 합니다.
The parameter of a unary operator must be the containing type
연산자 오버로드에 대한 메서드는 해당 지침에 따라 선언해야 합니다. 자세한 내용은 오버로드할 수 있는 연산자 및 연산자 오버로드 샘플을 참조하십시오.
예제
다음 샘플에서는 CS0562 오류가 발생하는 경우를 보여 줍니다.
// CS0562.cs
public class iii
{
public static implicit operator int(iii x)
{
return 0;
}
public static implicit operator iii(int x)
{
return null;
}
public static iii operator +(int aa) // CS0562
// try the following line instead
// public static iii operator +(iii aa)
{
return (iii)0;
}
public static void Main()
{
}
}