After looking at compile errors because I was not overriding this function ( although being convinced that I was) I have a query for all you C++ buffs in the audiance. What does the ^ do in the following line.

virtual System::Object ^ Clone(void) override;

I know this is quite possably a stupid question and for that I am quite sorry.

9 Years
Discussion Span
Last Post by Traicey

Ok, Replying to my own thread here, But I have had a look around the net and from what I can tell it refers to a reference to a managed type in .NET. I may be wrong ( since I have seen nothing that has said this yet )


As u said........ a caret [^] is a managed reference (usually called a handle in C++/CLI) is a reference to a managed .NET object. Managed object's lifetimes that are controlled by the .NET garbage collection system which needs to be able to track all references to managed objects. Having separate syntax for managed references / handles and regular native references helps makes this distinction explicit in the code and avoid confusion between managed / garbage collected .NET types and unmanaged native types whose lifetimes must still be managed explicitly by the programmer.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.