简体   繁体   中英

problem with inherit a c# class in c++ code

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 error 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. eg (untested):

public ref class MyCppCliClass : public My.Namespace.CsClassname { };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM