Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Object Class Reference

Reference counting base class. More...

`#include <xfc/object.hh>`

Inheritance diagram for Xfc::Object:

List of all members.

## Public Member Functions

- virtual void ref ()
    Increase an object's reference count by one.
- virtual void unref ()
    Decrease an object's reference count by one.

## Protected Member Functions

- Object ()
    Constructor.
- virtual ~Object ()=0
    Destructor.

## Detailed Description

Reference counting base class.

Object is a base class that implements reference counting. Derived from Trackable, it adds an integer reference counter so that dynamic objects can have their memory allocation handled by the XFC smart pointer: Pointer<>. This keeps the memory management in XFC consistent across all classes. If you derive a class from Xfc::Object and allocate it on the heap, you free the memory and destroy the object by calling unref(), not delete.

Note if you declare a class that derives from Xfc::Object on the stack you don't need to call unref(). It's not an error to do so though because nothing will happen.

## Member Function Documentation

virtual void Xfc::Object::unref | ( |  | ) | `[virtual]`

| Decrease an object's reference count by one. When the reference count becomes zero delete is called. Remember, with Object you must call unref() on dynmaically allocated objects, not delete. Reimplemented from Xfc::Trackable. Reimplemented in Xfc::G::AsyncQueue.

The documentation for this class was generated from the following file:

- libXFCcore/xfc/object.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3