我只是一个编程新手。目前在我的学期学习 C++。所以基本上我有 C++ 的基本知识。我使用 Visual Studio Express 2013 进行基本编码。 我有一项任务是获取订单、显示订单、计算总价并打印收据。这次讲师要求我们尝试使用.NET 或 C# 的接口(interface)。我看过一些关于如何使用 C# 创建接口(interface)的视频,但我一直在思考如何将 C++ 中的代码与 C# 中的接口(interface)一起使用?
非常感谢您的回复!
最佳答案
C++ 中没有接口(interface)。您可以使用纯虚方法编写一个类来实现相同的功能:
C#
interface Foo {
void Bar();
}
C++
class Foo {
public:
virtual void Foo()=0;
}
这是一个wiki link了解更多信息。
关于c# - 如何使用 Visual Studio Express 2013 将 C# 接口(interface)实现/合并到一个简单的 C++ 程序中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28481398/