Call C++ functions from C#/.NET
问题 I have a solution which has a C++ project and a C# project. The C++ project defines a class, which I want to instantiate in C# and call its member functions. So far I managed to instantiate the class: CFoo Bar = new CFoo(); But when I try to call a function on it, the compiler says, it is not available. Also, when I inspect the object in the debugger, no members are shown. What am I missing here? 回答1: You need to declare the class in C++/CLI as a ref class . (Note that we're talking about C++