Advertisement
Guest User

Garbage Collection Example - C++/CLI

a guest
Jan 6th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. // GarbageCollection_CLI.h
  2.  
  3. #pragma once
  4.  
  5. using namespace System;
  6.  
  7. namespace GarbageCollection_CLI {
  8.  
  9.     public ref class ObjectHolder
  10.     {
  11.     private:
  12.         Object^ mSomeObject;
  13.  
  14.     public:
  15.         ObjectHolder(Object^ someObject)
  16.         {
  17.             mSomeObject = someObject;
  18.         }
  19.  
  20.         property bool ObjectExists
  21.         {
  22.             bool get()
  23.             {
  24.                 return mSomeObject != nullptr;
  25.             }
  26.         }
  27.  
  28.         ~ObjectHolder()
  29.         {
  30.             mSomeObject = nullptr;
  31.         }
  32.     };
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement