加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 什么是多重虚拟继承?

发布时间:2020-12-16 06:59:52 所属栏目:百科 来源:网络整理
导读:class foo : public virtual bar,public virtual kung{ // implementation of the method of the above inherited class}; bar和kung类是一个抽象类,它包含在foo clas中实现的纯虚方法. 有什么用? 解决方法 在你的情况下,如果bar和kung是派生得最多的基类,
class foo : public virtual bar,public virtual kung
{
  // implementation of the method of the above inherited class
};

bar和kung类是一个抽象类,它包含在foo clas中实现的纯虚方法.

有什么用?

解决方法

在你的情况下,如果bar和kung是派生得最多的基类,只要没有bar和kung中的方法发生冲突就会没有区别,但如果确实如此,你就会知道它,即编译器在模糊定义中的错误.

有关此问题的更多信息,请参见c faq:http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.9

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读