#include <AutoDestructor.h>


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 AutoDestructor & | operator= (const AutoDestructor &) |
| AutoDestructor (const AutoDestructor &) | |
Private Attributes | |
| const Object & | _o |
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";
Definition at line 93 of file AutoDestructor.h.
| 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
| String AutoDestructor::getClassName | ( | ) | const [virtual] |
Returns the name of the class
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] |
const Object& alize::AutoDestructor::_o [private] |
Definition at line 104 of file AutoDestructor.h.
Referenced by ~AutoDestructor().
1.7.2