Does the ^ symbol replace C#'s “ref” in parameter passing in C++/CLI code?

后端 未结 5 1908
轻奢々
轻奢々 2020-12-13 15:25

In C#, passing by reference is:

void MyFunction(ref Dog dog)

But in C++/CLI code examples I have seen so far, there is no use of ref<

5条回答
  •  再見小時候
    2020-12-13 16:03

    The "^" symbol indicates that "Dog" is a CLR object, not a traditional C++ object such as "Dog*", which is a pointer to a C++ object Dog. This means that "Dog ^ dog" has the same meaning as "Dog dog" (not "ref Dog dog") in C#

提交回复
热议问题