what does this symbol ' ^ ' represent in C++

Hi everyone. I recently came across C++ code that use this ^to declare variables. Please see example code below.
1
2
3
private: System::Windows::Forms::Button^  Button1000;
	private: System::Windows::Forms::Label^  ChannelLabel;
	private: System::Windows::Forms::Button^  ButtonDisable;


I don't know what this symbol represents. Could it be some kind of a special pointer maybe. If anybody knows what it represents please share your knowledge.
The code you're looking at is C++/CLI instead of native C++. C++/CLI is a Microsoft language meant to provide interop between the native C++ world and the managed world of .NET. The syntax here indicates .NET managed references, which are subject to garbage collection by the .NET Runtime's memory management system. On regular C++ pointers you'd have to delete them yourself or use RAII techniques to release acquired resources appropriately. These managed references do not require this.

The way they are allocated is different, as well. Managed resources use gcnew instead of new.
closed account (z05DSL3A)
That is C++/CLI not C++ and it's a "handle" and is kind of like a cross between a pointer and a reference.
Thank you guys. One last question; I am suppose to expand this code with new features. Can I do this with pure C++ or must I learn C++/CLI to add these features.
It depends on what features you're trying to expand. If you are making modifications to the GUI, you should probably be more familiar with C++/CLI. The types you presented in the original post come from a Microsoft-specific UI toolkit called Windows Forms. These libraries are all .NET libraries, which is why the C++/CLI syntax is needed. If your GUI is not changing, and you are only altering some background calculations in code that seem to be pure C++, you can probably get by on your pure C++ coding ability.
closed account (1CfG1hU5)
older c languages, '^' is an exclusive or operator, in the newer languages i believe
is used for pointers. someone please post if I am incorrect about the pointer.
I think it's reference to managed object in C++/CLI.
I have to say this language is a monster!

someone please post if I am incorrect about the pointer.

You are correct when you say ^ is the bitwise exclusive OR operator, but you are incorrect in saying it is being used here.
In C++ ^ is a bitwise xor. In C++/CLI it is both a bitwise xor and managed handle.
closed account (1CfG1hU5)
saw ^ being used with strings somewhere. i'll look online for a reference maybe later.

incorrect in saying being used here? you're saying that ^ isn't used here?
or do you mean that not used here for use with strings?

looking for a more specific response
I was just saying it is not being used as an xor operator in this context.
Operators (such as ^) can have different meanings in different contexts.
Using it in the OPs context it's a 'managed' pointer.
Topic archived. No new replies allowed.