What are the similarties/differences between a C++ reference and a C# reference ?
Edit:
I’m talking about Object references,as I’m a newbie I was unaware that such a simple line would cause ambiguity,as I have read. Whenever the term “reference” is used,its in context to Object reference,otherwise its explicitly quoted as “managed references”.
I think all the people who have answered this question have got what I was trying to say and I made a comment that states clearly what I wanted to ask. I don’t see any reason for a downvote,come on guys.
This question does not deserve to be closed.As newbies like me can learn from the insight a lot of experienced people have provided.
C# references are closer to C++ pointers than to C++ references.
C# references can be null and have assignment semantics similar to pointers. The difference is that they are black boxes(you can’t convert them to integral types) and you can’t do arithmetic on them. They also can only point to reference types.
C++ references are quite different(apart from being compiled to pointers too). They are closer to .net managed references which are used for
refparameters. But even then the assignment semantics differ.