# class KShared | Reference counting for shared objects. More...
Definition | `#include <ksharedptr.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KShared ()
- KShared ( const KShared & )
- KShared & operator= (const KShared & )
- void _KShared_ref ()
- void _KShared_unref ()
- int _KShared_count ()

#### Protected Methods

- virtual ~KShared ()

#### Protected Members

- int count

## Detailed Description

Reference counting for shared objects. If you derive your object from this class, then you may use it in conjunction with KSharedPtr to control the lifetime of your object.

Specifically, all classes that derive from KShared have an internal counter keeping track of how many other objects have a reference to their object. If used with KSharedPtr, then your object will not be deleted until all references to the object have been released.

You should probably not ever use any of the methods in this class directly -- let the KSharedPtr take care of that. Just derive your class from KShared and forget about it.

KShared () | ### KShared

Standard constructor. This will initialize the reference count on this object to 0

KShared ( const KShared & ) | ### KShared

Copy constructor. This will not actually copy the objects but it will initialize the reference count on this object to 0

KShared & operator= (const KShared & ) | ### operator=

Overloaded assignment operator

void _KShared_ref () | ### _KShared_ref

Increases the reference count by one

void _KShared_unref () | ### _KShared_unref

Releases a reference (decreases the reference count by one). If the count goes to 0, this object will delete itself

int _KShared_count () | ### _KShared_count

Return the current number of references held

Returns: Number of references

~KShared () | ### ~KShared

[protected virtual]

int count | ### count

[protected]

- Version: $Id: ksharedptr.h,v 1.17 2001/01/02 14:18:21 hausmann Exp $
- Author: Waldo Bastian <bastian@kde.org>
- Generated: root@sparc.ports.openbsd.org on Wed May 2 09:34:58 2001, using kdoc 2.0a53.