컴파일러 경고(수준 1) CS1957
업데이트: 2007년 11월
오류 메시지
'name' 멤버는 'method'을(를) 재정의합니다. 런타임에 여러 재정의 후보가 있습니다. 호출되는 메서드는 구현에 따라 다릅니다.
Member 'name' overrides 'method'. There are multiple override candidates at run-time. It is implementation dependent which method will be called.
런타임에서는 ref인지, out인지만 다른 메서드 매개 변수를 구분하지 못합니다.
이 경고를 방지하려면
- 메서드 이름을 다르게 지정하거나 매개 변수 개수를 다르게 지정합니다.
예제
다음 코드에서는 CS1957 오류가 발생하는 경우를 보여 줍니다.
// cs1957.cs
class Base<T, S>
{
public virtual string Test(out T x) // CS1957
{
x = default(T);
return "Base.Test";
}
public virtual void Test(ref S x) { }
}
class Derived : Base<int, int>
{
public override string Test(out int x)
{
x = 0;
return "Derived.Test";
}
static int Main()
{
int x;
if (new Derived().Test(out x) == "Derived.Test")
return 0;
return 1;
}
}