This code is as you can see an = operator overloading, take a string class as its parameter, then check difference between this and that string, create new string and swap between strTemp.m_pData and this.m_pData. So when the function returns, strTemp, pointing to current data is deleted, then this.m_pData is assigned new value from temporary. But since strTemp is deleted, would this.m_pData pointing to NULL ????
Nope. strTemp destructor will destroy old m_pData which was contained in *this and isn't needed now. Both *this and str will contain identical copies of m_pData if copy constructor was properly defined.