name=$name;
$this->type=$type;
}
function vod(){
return $this->name.$this->type.'播放电影';
}
function game(){
return $this->name.$this->type.'玩游戏';
}
/************************
* 当对象内部的操作执行完毕的时候,
* __destruct()被调用,
* 然后对象所使用的内存被释放出来。规则:后进先出
**************************/
function __destruct(){
echo
==============.$this->name;
}
}
$pc1 = new mypc('家用电脑','台式机');
echo $pc1->vod().
;
//当$pc1=null;的时候是当前实例操作完成后直接释放出对象
$pic2 = new mypc('公司电脑','笔记本');
echo $pic2->game();
http://www.bkjia.com/phpjc/740210.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/740210.htmltecharticle复制代码 代码如下: ?php /********************************************** * __construct 对象初始化函数使用 * destruct 析构函数的使用 * $this 关键字的使用(...