且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是符号^%意味着在c ++项目

更新时间:2023-11-08 20:25:10

这意味着你所拥有的不是真正的C ++,而是C ++ / CLI,微软的.NET语言的专有版本。 / p>

如果内存正在运行, ^%是跟踪引用的语法, )与C#中的 ref 相同,从C ++的角度来看,它与定义一个参数作为指针的引用几乎一样。


i have a c# project AAA with the project type "class library", in another c++ project, it add the AAA.DLL in the reference, in the source code

void CTest:OnCallback(OperationCallbackInfo^% oci)

OperationCallbackInfo is class defined in AAA.dll

my question is: what does the symbol ^ and % mean in the parameter?

It means what you have isn't really C++ at all, but C++/CLI, Microsoft's proprietary version of the language for .NET.

If memory serves, ^% is the syntax for a "tracking reference". It means (at least pretty much) the same as ref does in C#. From a C++ point of view, it's pretty much the same as defining a parameter as a reference to a pointer.