tags:

views:

279

answers:

4

Is that .NET related? It appears to be a pointer of some sort, what is the difference?

Edit:

I actually know it is the XOR operator, but look at this example from this page.

void objectCollection() {
    using namespace System::Collections;

    **ArrayList ^as = gcnew ArrayList;**

    //... }

What is this?

Thanks.

+5  A: 

In C++, that is the XOR operator.

Kevin
-1 Because this answer is wrong in this context.
Outlaw Programmer
+1 to nullify the -1 because the answer was given before the question was edited to include the example.
Naveen
+1 because it is correct for /C++/. Managed C++ is not C++.
Matthew Flaschen
+13  A: 

I'm assuming that you're looking at constructs of the form:

Foo ^bar = gcnew Foo();

You're right, in .NET it is a pointer-"like" type and is part of C++/CLI, not but not standard ISO C++.

It's a reference to a garbage-collected, managed .NET object as opposed to a regular, unmanaged C++ object.

As the other poster suggest, outside the .NET world or in a non-object creation context, it is the XOR operator.

Timo Geusch
A: 

I actually know it is the XOR operator, but look at this example from this page.

void objectCollection()
{
    using namespace System::Collections;

    **ArrayList ^as = gcnew ArrayList;**

    //...
}

What is this?

See above - the statement creates a handle/reference to a garbage collected .NET ArrayList object.
Timo Geusch
You can edit your question instead of writing an asnwer, so it will be clear for everyone what you meant. Thanks!
splattne
A: 

That's a handle to a .NET reference type, when using Managed C++. See this.

orip
That's C++/CLI - Managed C++ is another beast that was mercifully put down.
Eclipse
Thanks for the clarification, good to know
orip