如何在托管c++中实现接口
How to implement an interface in managed c++?
下面是我声明的接口:
[ServiceContract]
public interface class IShedluer
{
[OperationContract]
array<Object^>^ GetResult(UInt64 taskId);
}
下面是试图实现它的类:
ref class MyShedluer:IShedluer
{
Shedluer ^shedluer;//this is NOT MyShedluer
public:
MyShedluer(void);
array<Object^>^ GetResult(UInt64 taskId)
{
return shedluer->GetResult(taskId);
}
}
当我试图编译这个时,我得到了
Error 15 error C3766: 'MyShedluer' must provide an implementation for
the interface method 'cli::array<Type> ^IShedluer::GetResult(unsigned __int64)'
d:usersmenkaurdocumentsvisual studio 2010projectsMyProject
kernelMyShedluer.h 78 1 MyProject.Kernel
为什么我会得到这个?
virtual
:
ref class MyShedluer:IShedluer
{
public:
virtual array<Object^>^ GetResult(UInt64 taskId);
}
编译器也告诉你这一点,看看你的警告:
warning C4488: 'MyShedluer::GetResult' : requires 'virtual' keyword
to implement the interface method 'IShedluer::GetResult'
相关文章:
- 如何从实现接口的模板化类实例访问结构
- 如何在C++中实现接口
- unique_ptr实现接口时对已删除函数的引用
- 避免对实现接口的类使用多个几乎相同的声明
- C#COM组装实现C 接口
- 当传递对类的引用时,优于另一个函数,即实现接口
- 通过其方法的子集实现接口
- C ++类实现接口,接口具有采用任何实现该接口的类的方法
- 错误:在 C++ 中实现接口模式时未定义对 typeinfo 的引用
- 与模板实现接口的类模板
- 在主应用程序中声明的 dll 中实现接口 - C++
- Objective-C类实现C 接口
- 如何添加实现C 接口的标签
- 强制接收实现接口的超类指针作为方法的参数
- 我可以部分实现接口层次结构吗
- 是否可以通过继承实现接口
- 在c++中实现接口
- 如何使用谷歌测试测试实现接口的不同类/结构
- 使用成员函数模板实现接口的功能
- C++ 11 实现接口的方法不可用。为什么?