如何在Windows Phone运行时组件中使用本机类 我试图使用静态库重用一些C++代码。 例如,如果这是我在静态库中的C++类。 class testclass { testclass(); ~testclass(); void printsomethig(); void dosomething(); };
现在我想在我的运行时项目中继承这个类,稍后我想从我的WindowsPhone8C#项目调用它,但问题是本机类不能是公共的,如果不是公共的,我就看不到方法和函数。例如:如何在Windows Phone运行时组件中使用本机类 我试图使用静态库重用一些C++代码。 例如,如果这是我在静态库中的C++类。 class testclass { testclass(); ~testclass(); void printsomethig(); void dosomething(); };,c++,windows-runtime,windows-phone-8,native,C++,Windows Runtime,Windows Phone 8,Native,现在我想在我的运行时项目中继承这个类,稍后我想从我的WindowsPhone8C#项目调用它,但问题是本机类不能是公共的,如果不是公共的,我就看不到方法和函数。例如: public class runtimeTestClass : testclass { runtimeTestClass(); ~runtimeTestClass(); }; 问题是在运行时本机不能是公共的(错误消息),必须是 public ref runtimeTestClass sealed { runt
public class runtimeTestClass : testclass
{
runtimeTestClass();
~runtimeTestClass();
};
问题是在运行时本机不能是公共的(错误消息),必须是
public ref runtimeTestClass sealed
{
runtimeTestClass();
~runtimeTestClass();
};
但这样我就不能继承任何东西
有人知道我怎么解决这个问题吗
提前感谢您如果我是您,我会选择在现有类周围创建WinRT包装,而不是使用继承 如果您将
runtimeTestClass
WinRT类的所有功能委托给testclass
的私有实例,那么您将能够从c#使用它。可能重复的