#include <Ptr.h>
Public Member Functions | |
Ptr () | |
Ptr (const Ptr< T > &other) | |
Ptr (T *other) | |
~Ptr () | |
Ptr< T > & | operator= (const Ptr< T > &other) |
T & | operator* () const |
T * | operator-> () const |
operator T * () const | |
T * | ptr () const |
void Function() { Test *test = new Test(); // wrong Ptr<Test> test(new Test); // right use of smart pointer }
Constructor
Note: Stores the pointer to an object
other | New pointer |
Constructor
Note: Stores the pointer to an object
New | pointer |
Releases old reference if any and stores the new reference
other | New pointer |
T& Ptr< T >::operator* | ( | ) | const [inline] |
Return reference to the object
T* Ptr< T >::operator-> | ( | ) | const [inline] |
Access member of the object
Ptr< T >::operator T * | ( | ) | const [inline] |
Returns pointer to the object
T* Ptr< T >::ptr | ( | ) | const [inline] |
Returns pointer to the object