如何在C ++ / CLI中显式/隐式实现接口成员? [英] How to explicitly/implicitly implemented interface members in C++/CLI?

查看:157
本文介绍了如何在C ++ / CLI中显式/隐式实现接口成员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在C ++ / CLI中是等价的:

What's the equivalent in C++/CLI of this:

class Explicit : IClonable
{
    void IClonable.Clone()
    {
    }
}

class Implicit : IClonable
{
    public void Clone()
    {
    }
}


推荐答案

因为nobugz说,你不能明确实现IDisposable。

As nobugz says, you can't explicitly implement IDisposable.

所以,假设你的问题的标题是准确的,你想明确实现接口成员(或在C ++ / CLI中支持的显式覆盖,但我不认为在C#中可能,C ++ / CLI还提供更多的灵活性来覆盖具有相同功能的多个v表槽),参见:

So, assuming that the title of your question is accurate, and you want to have explicit implementation of interface members (or explicit overrides which are supported in C++/CLI but I don't think are possible in C#, C++/CLI also provides more flexibility to override multiple v-table slots with the same function), see:

http://msdn.microsoft.com/ en-us / library / fw0bbh51.aspx

这篇关于如何在C ++ / CLI中显式/隐式实现接口成员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆