php/**
*
* @category my test OOP
* @package null
* @author Rao Hongfu * @copyright myself
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version null
* @link http://blog.sina.com.cn/hongfu08
* http://blog.111cn.net/hongfu_
**/classmyTest {privatefunctionmyTest(){
}static$name=null;static$qq=null;publicfunctiongetInstance() {returnnewmyTest();
}publicfunctionsetName($name) {$this->name=sprintf("%s",$name);
}publicfunctionsetQQ($qq) {$this->qq=intval($qq);
}publicfunctiongetName() {return$this->name;
}publicfunctiongetQQ() {return$this->qq;
}publicfunctionexcute() {returnsprintf("My Name Is %s AND
My QQ Is %d",$this->name,$this->qq) ;
}
}$obj=myTest::getInstance();$obj->setName(''raohongfu'');$obj->setQq(''59547993'');$name=$obj->getName();$qq=$obj->getQq();var_dump($name,$qq);$result=$obj->excute();print_r($result);?>
本文原创发布php中文网,转载请注明出处,感谢您的尊重!