在c ++语言中添加多个inhritance的接口 [英] adding an interface for multiple inhritance in c++ language

查看:140
本文介绍了在c ++语言中添加多个inhritance的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请任何人都可以向我解释如何为多重继承添加接口,例如我们有从类A和类B继承的类c。

谢谢你提前

please any one can explain to me how to add an interface to multiple inheritance such as we have class c inherited from class A and class B.
THANK YOU IN ADVANCE

推荐答案

如果我理解正确的话,你已经有了一个继承自其他两个类的类,现在你想要为这个类添加一个接口。

那是对的吗?



无论如何要在C ++中使用接口,你需要使用COM和IDL文件而你可能不会我想沿着这条路走下去。



相反,在C ++中你使用抽象类,你可以阅读并找到这里的例子

< a href =http://www.tutorialspoint.com/cplusplus/cpp_interfaces.htm> C ++中的接口(抽象类) [ ^ ]
If I understand you correctly you already have a class that inherits from two other classes and now you want to add an interface to the pot.
Is that about right?

In any case to use interfaces in C++ you need to use COM and IDL files and you probably don't want to go down that path.

Instead, in C++ you use abstract classes and you can read about and find examples here
Interfaces in C++ (Abstract Classes)[^]


这篇关于在c ++语言中添加多个inhritance的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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