Public Member Functions | Private Member Functions | Private Attributes

alize::AutoDestructor Class Reference

#include <AutoDestructor.h>

Inheritance diagram for alize::AutoDestructor:
Inheritance graph
[legend]
Collaboration diagram for alize::AutoDestructor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AutoDestructor (const Object &)
virtual ~AutoDestructor ()
virtual String getClassName () const

Private Member Functions

bool operator== (const AutoDestructor &) const
bool operator!= (const AutoDestructor &) const
const AutoDestructoroperator= (const AutoDestructor &)
 AutoDestructor (const AutoDestructor &)

Private Attributes

const Object_o

Detailed Description

An AutoDestructor object can store a pointer on an Object object. When the AutoDestructor object is destroyed, it destroys the pointed Object object. This avoids doing memory leak.

Example :

void myMethod()
{
String ss = new String("test");
AutoDestructor aa(ss);
...
} // when you leave the method, aa is destroyed and ss is destroyed too without doing a "delete ss";

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2003

Definition at line 93 of file AutoDestructor.h.


Constructor & Destructor Documentation

AutoDestructor::AutoDestructor ( const Object o ) [explicit]

Definition at line 65 of file AutoDestructor.cpp.

AutoDestructor::~AutoDestructor (  ) [virtual]

Definition at line 70 of file AutoDestructor.cpp.

References _o.

alize::AutoDestructor::AutoDestructor ( const AutoDestructor  ) [private]

Not implemented


Member Function Documentation

String AutoDestructor::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Definition at line 68 of file AutoDestructor.cpp.

bool alize::AutoDestructor::operator!= ( const AutoDestructor  ) const [private]

Not implemented

const AutoDestructor& alize::AutoDestructor::operator= ( const AutoDestructor  ) [private]

Not implemented

bool alize::AutoDestructor::operator== ( const AutoDestructor  ) const [private]

Member Data Documentation

Definition at line 104 of file AutoDestructor.h.

Referenced by ~AutoDestructor().


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