李伊雅大師的記錄
我的網誌清單
2014年1月21日 星期二
C++ class 如果不要讓人可以 Copy 如何做?
class Nocopy{
public :
Nocopy(){}
private :
//把複載運算子寫在 private 裡即可喔 , 之後所有繼承此物件皆不可以複製
Nocopy(const Nocopy& other){}
Nocopy& operator = (const Nocopy& other){ return *this; }
};
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言