分类:
2008-04-14 17:11:02
//////////////////// <?class helloWorld{ var $hellow_str = "Hello World!"; function helloWorld(){ echo $this->hellow_str; } } $p = new helloWorld; ?> //////////////////// |
//////////// class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; } /////////// |
//////////////// class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function move(){ #.... } function largen(){ #... } }/////////////// |
//////////////// class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function move(){ #.... } function largen(){ $this->desktop++;#放大桌子面 } } $d = new desktop;#“实例化,这个时候我们就是针对一个特定的桌子拉! $d->largen();#哈哈,把这个特定桌子面放大点。其实$d = $this;明白吗,$d就是那个特定的桌子,$d->largen就是用那个特定桌子[桌子群大家都有的变大方法]把特定桌子面放大了点。 /////////////// |
//////////////// class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function desktop(){ $this->desktop = 100; $this->baluster = 100; } function move(){ #.... } function largen(){ $this->desktop++;#放大桌子面 } } //////////// 看到了吧,我把桌子定义了大小和长度哦 ////////// |
////////////// class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function desktop(){ $this->desktop = 100; $this->baluster = 100; } function move(){ #.... } function largen(){ $this->desktop++;#放大桌子面 } } $d = new desktop; $d->desktop(); //////////////////// |
function desktop(){ $this->desktop = 100; $this->baluster = 100; } |
////////////// <? class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function desktop(){ $this->desktop = 100; $this->baluster = 100; echo "我们桌子家族命令大家把桌子面子都给我统一在".$this->desktop."大小!<br />"; } function move(){ #.... } function largen(){ $this->desktop++;#放大桌子面 echo "7~,小桌子我今天改造了,不鸟你们拉,哈哈, 我现在面子可比你们大,我有".$this->desktop."嘎嘎"; } } $d = new desktop; $d->largen(); ?> |
////////////// <? class desktop{ var $desktop;#桌子面; var $baluster;#桌子腿; function desktop($desktop){ $this->desktop = $desktop; $this->baluster = 100; echo "我们桌子家族命令大家把桌子面子都给我统一在".$this->desktop."大小!<br />"; } function move(){ #.... } function largen(){ $this->desktop++;#放大桌子面 echo "7~,小桌子我今天改造了,不鸟你们拉,哈哈, 我现在面子可比你们大,我有".$this->desktop."嘎嘎"; } } $d = new desktop; $d->largen(); ?> |
///// $d = new desktop(101); //// |