I have two projects, one written in c# and the other in c++. I was able to use the class written in c++ in c#. But when I try to inherit a class in c# from c++, I got the er开发者_开发百科ror saying c++ code can find the namespace of c# code.
I am using visual studio 2008 professional. Is there a way to inherit a class that is written in c# in c++ code?
Thanks
No. You cannot inherit a C# (managed) class in a C++ (native) class. If you meant to say that you have a C++/CLI class, then yes you can.
Actual code and the actual error would be helpful (given that you've clearly failed to reproduce the error text correctly). I would suggest first verifying that you have a valid reference to the C# project in the C++/CLI project and that you've properly scoped the name of the C# class where you use it. e.g. (untested):
public ref class MyCppCliClass : public My.Namespace.CsClassname { };
精彩评论