Hi,
I have just wrote the following code ( only showing part of class ) :
template<class T> class DAPointer {
T* m_pPtr;
public:
inline DAPointer( T* p=0 ) : m_pPtr(p){}
inline ~DAPointer() { m_pPtr = NULL; }
// etc....
};
template<class T> class DAPointer {
T* m_pPtr;
public:
inline DAPointer( T* p=0 ) : m_pPtr(p){}
inline ~DAPointer() { m_pPtr = NULL; }
// etc....
};
To copy to clipboard, switch view to plain text mode
What it is meant to do is just set a pointer to NULL after I've deleted it.
For example :
DAPointer<TestObject>obj;
obj = new TestObject;
delete obj; // <---------------- error : cannot convert from DAPointer<T> to void *
DAPointer<TestObject>obj;
obj = new TestObject;
delete obj; // <---------------- error : cannot convert from DAPointer<T> to void *
To copy to clipboard, switch view to plain text mode
What am I missing in order to allow the delete function not to give conversion error?
Kind regards,
Steve
Bookmarks