Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6109217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:22:47+00:00 2026-05-23T14:22:47+00:00

In C#, passing by reference is: void MyFunction(ref Dog dog) But in C++/CLI code

  • 0

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 but instead ^ symbol is used:

void MyFunction(Dog ^ dog)

Is the use of ^ symbol a direct replacement for ref when parameter passing? or does it have some other meaning I’m not aware of?

Additional Question: I also see a lot of:

Dog ^ myDog = gcnew Dog();

It looks like it’s used like * (pointer) in C++.. Does it work similarly?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:22:48+00:00Added an answer on May 23, 2026 at 2:22 pm

    If Dog is a reference type (class in C#) then the C++/CLI equivalent is:

    void MyFunction(Dog^% dog)
    

    If Dog is a value type (struct in C#) then the C++/CLI equivalent is:

    void MyFunction(Dog% dog)
    

    As a type decorator, ^ roughly correlates to * in C++, and % roughly correlates to & in C++.

    As a unary operator, you typically still need to use * in C++/CLI where you use * in C++, but you typically need to use % in C++/CLI where you use & in C++.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the difference between passing-by-reference and using the C pointer notation? void some_function(some_type&
I have a question regarding the passing of a map by reference. Let's consider
The question: Is there benefit to passing an integral type by const reference as
Is there a reason why passing a reference to a std::map as const causes
I have a problem passing by reference int or string variables to C++ ActiveX
As per title is there any difference passing a reference type to a method
So i thought i had the idea of passing by reference down, but it
I noticed that when passing reference parameters to boost bind, those parameters won't act
I'm passing a reference of a form to a class. Within this class I
What are the benefits of passing by pointer over passing by reference in C++?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.