A TOnlyPointerTo safe pointer points to and owns a single object. If a TOnlyPointerTo is copied, the pointer is transferred from one safe pointer to the other, so that only one pointer at a time points to the object. In the example:
TOnlyPointerTo<TA> a1 = new TA;
TOnlyPointerTo<TA> a2 = a1;
Now a2 points to the object, and a1 does not point to any object.
If the TOnlyPointerTo is destroyed, it destroys the object (if any) to which it points. The template can only be expanded on a class whose destructor is public.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker