### Reference Counted Objects

IMRefCounted is a public base class that can be used by any class that needs reference-counting semantics, similar to the IRefCounted class provided by the IBM Open Class library in the past. This version of IMRefCounted differs in two ways:

- IMRefCounted is thread safe. That is, its ``addRef``, `removeRef`, and `count` methods can be called from multiple threads simultaneously without causing data corruption.
- When an IMRefCounted object is created, its initial reference count is set to 0 rather than 1, which is what IRefCounted uses. An initial count of 0 makes IMRefCounted work much more cleanly with smart pointer classes such as ICountedPointerTo.

Counted Pointers

Using Counted Pointers
Using Reference Counted Objects