标签:复制构造 ons template example 构造 raw art 赋值 tor
#pragma once
template<typename T>
class smart_pointer
{
private:
T* m_pRawPointer;
public:
smart_pointer(T* pData) :m_pRawPointer(pData) {}
//复制构造函数
smart_pointer(const smart_pointer& anotherSP);
//赋值
smart_pointer& operator=(const smart_pointer& anotherSP);
//
T& operator* () const
{
return *(m_pRawPointer);
}
T* operator-> () const
{
return m_pRawPointer;
}
};
标签:复制构造 ons template example 构造 raw art 赋值 tor
原文地址:https://www.cnblogs.com/herd/p/10991563.html