컴파일러 오류 CS0737
업데이트: 2007년 11월
오류 메시지
'type name'은(는) 'member name' 인터페이스 멤버를 구현하지 않습니다. 'method name'은(는) public이 아니므로 인터페이스 멤버를 구현할 수 없습니다.
'type name' does not implement interface member 'member name'. 'method name' cannot implement an interface member because it is not public.
인터페이스 멤버를 구현하는 메서드는 공용으로 액세스할 수 있어야 합니다. 모든 인터페이스 멤버는 public입니다.
이 오류를 해결하려면
- 메서드에 public 액세스 한정자를 추가합니다.
예제
다음 코드에서는 CS0737 오류가 발생하는 경우를 보여 줍니다.
// cs0737.cs
interface ITest
{
int Return42();
// Try the following line instead.
// public int Return42();
}
struct Struct1 : ITest // CS0737
{
int Return42() { return (42); }
}
public class Test
{
public static int Main(string[] args)
{
Struct1 s1 = new Struct1();
return (1);
}
}