Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::ReferencedObject Class Reference

Reference counted base class. More...

`#include <inti/object.h>`

Inheritance diagram for Inti::ReferencedObject:

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

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

## Detailed Description

Reference counted base class.

ReferencedObject is a reference counting base class. Derived from ReferencedBase, it adds an integer reference counter so that dynamic objects can have their memory allocation handled by the Inti smart pointer: Pointer<>. This keeps the memory management in Inti consistent across all classes. If you derive a class from ReferencedObject 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 ReferencedObject on the stack you don't need to call unref();

## Member Function Documentation

virtual void Inti::ReferencedObject::unref | ( |  | ) | `[virtual]`

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

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

- object.h

Main Page - Footer