sonyhandle.hxx

来自「手柄类 我跟着钱能的书写的 不过收获了不少」· HXX 代码 · 共 29 行

HXX
29
字号
#include"sony.hxx"

class sonyhandle
{
private:
	sony* sp;
	int *count;
public:
	sonyhandle(sony * pp):sp(pp),count(new int (1)){}
	sonyhandle(const sonyhandle &sh):sp(sh.sp),count(sh.count){}
	sony * operator ->(){return sp;}
	sonyhandle& operator = (const sonyhandle & sh)
	{
		if(sh.sp==sp)
			return *this;
		(*this).~sonyhandle();
		sp=sh.sp;
		count=sh.count;
		(*count)++;
		return *this;
	}
	
	~sonyhandle()
	{
		if(--(*count)=0)
	    delete sp;
		delete count;
	}
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?