### IMRefCounted

  IMRefCounted is an abstract base class from which you can derive classes whose objects have reference counts. When an object is constructed, its initial reference count is zero. When converting your code to use IMRefCounted, consider that its behavior differs from that of the deprecated IRefCounted class.

  When adding and removing references, call the addRef and removeRef functions. Consider using ICountedPointerTo, which is a smart pointer that handles reference counting automatically, if you want addRef and removeRef called implicitly.

  An object is deleted when its reference count reaches zero. All IMRefCounted functions are thread safe.

  When converting your code to use IMRefCounted, consider that its behavior differs from that of the deprecated IRefCounted class.

### IMRefCounted - Member Functions and Data by Group

### Constructors & Destructor

Use these constructors and destructor to create and destroy new objects with reference counters set to zero. T

~IMRefCounted
  Destroys the IMRefCounted object.

      protected:
      virtual ~IMRefCounted()

  The destructor deletes the object from the heap. If your class derives from IMRefCounted and it needs to perform cleanup tasks, you should override the destructor. The destructor is called when the reference count is zero.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IMRefCounted
  This function is provided for completeness to give subclassed constructors an inherited method to call. It does not copy the reference count; instead, the reference count of the new object is initialized to zero.

  Overload 1
  Copy-constructs a reference-counted object.

      protected:
      IMRefCounted(const IMRefCounted&)

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2
  Constructs a new object with an initial reference count of zero.

      protected:
      IMRefCounted()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

operator =
  Assigns a reference-counted object.

      protected:
      IMRefCounted& operator =(const IMRefCounted&)

  This function is provided for completeness to give subclassed copy constructors an inherited method to call. It does not copy the reference count; instead, the reference count of the new object is initialized to zero.

  IMRefCounted
    A constant reference to the IMRefCounted exception object to be copied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Incrementing and Decrementing the Counter

Use these functions to manage the reference count on the object.

addRef
  Increments the reference count.

      public:
      void addRef()

  This function adds a new reference to the object whose counter is maintained. Call this function when you create a pointer that refers to the object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeRef
  Decrements the reference count.

      public:
      void removeRef()

  This function decrements the reference count to an object. Call it when you are finished using a pointer to the object. When an object's reference count is zero, the object is deleted.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Obtaining the Current Reference Count

Use these functions to access information about the reference count of the object.

count
  Returns the current reference count.

      public:
      unsigned long count() const

  This function returns the number of existing references to the object. When the object's reference count is zero, the object is deleted.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IMRefCounted - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None