c++ cli - Meaning of '^' with class name in Cpp -
I was reading some code in CPP and I
& lt; Classname & gt; ; ^ Instancename
What is the use of it ??
I tried to search but I could not find any answer.
This represents a managed index, ^ Trash points the collected object (handled by the framework goes).
You can check for more details
In Visual C ++ 2002 and Visual C ++ 2003, use __GC * to declare a managed index it was done. For example, it is allocated individually for example:
code> native object * n = new native object ( ); Managed object ^ m = gcnu managed object ();Also check for more details
This sample shows how to create an example of a reference type on the managed pile. This sample also shows that you can start handling with each other, as a result there are two references to the same object on the trash-collected pile. Notice that the object assigning nullptr (C ++ Component Extensions) to a handle does not mark for the garbage collection. Compile with
// mcppv2_handle.cpp // / CLR Ref class MyClass {public: MyClass (): I () {} int i; Zero trials () {i ++; System :: Console :: WriteLine (i); }}; Int main () {MyClass ^ p_MyClass = gcnew MyClass; P_MyClass- & gt; Test (); Mayclass ^ p_MyClass2; P_MyClass2 = p_MyClass; P_MyClass = nullptr; P_MyClass2- & gt; Test (); }
Comments
Post a Comment