我这样做没有任何问题(不能把它放在评论中):
namespace ClassLibrary1
{
public class SomeClass {}
public class SomeClass1 {}
public class SomeClass2 {}
public interface IInterface
{
object Get(SomeClass a);
object Get(SomeClass a, SomeClass1 b);
object Get(SomeClass a, SomeClass2 c);
}
public class Implementation : IInterface
{
public object Get(SomeClass a)
{
return null;
}
public object Get(SomeClass a, SomeClass1 b)
{
return null;
}
public object Get(SomeClass a, SomeClass2 c)
{
return null;
}
}
}
和 C++/CLI 代码
using namespace System;
using namespace ClassLibrary1;
int main(array<System::String ^> ^args)
{
auto o = gcnew Implementation();
o->Get(gcnew SomeClass());
o->Get(gcnew SomeClass(), gcnew SomeClass1());
o->Get(gcnew SomeClass(), gcnew SomeClass2());
Console::WriteLine(L"Hello World");
return 0;
}
编译没有问题。