Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ cli c++/cli接口覆盖的显式实现_C++ Cli - Fatal编程技术网

C++ cli c++/cli接口覆盖的显式实现

C++ cli c++/cli接口覆盖的显式实现,c++-cli,C++ Cli,我有两个接口: public interface I1 { A MyProperty { get; set; } } public interface I2 : I1 { new B MyProperty { get; set; } } 在C#中,我可以明确地实现如下: public class C : I1, I2 { public B MyProperty { get; set; } A I1.MyProperty { get; set; } } 我不得

我有两个接口:

public interface I1
{
    A MyProperty { get; set; }
}

public interface I2 : I1
{
    new B MyProperty { get; set; }
}
在C#中,我可以明确地实现如下:

public class C : I1, I2
{
    public B MyProperty { get; set; }
    A I1.MyProperty { get; set; }
}
我不得不在c++/cli项目中使用这些接口。那么,如何在c++/cli中实现这一点呢


提前谢谢。

我自己解决了。应该是:

public ref class C : I1, I2
{
public:
    virtual property B^ MyProperty
    {
        B^ get() { ... }
        void set(B^ value) { ... }
    }

 protected:
     virtual property A^ DummyProperty
     {
         A^ get() = I1::MyProperty::get { return nullptr; }
         void set(A^ value) = I1::MyProperty::set { }
     }
 }