氓风
2015-05-13 14:08
<?php
class NbaPlayer{
public $name;
public $height;
public $weight;
public $team;
public $playerNumber;
public function run(){
echo "Running\n";
}
public function jump(){
echo "Jumping\n";
}
public function dribble(){
echo "Dribbling\n";
}
public function shoot(){
echo "Shooting\n";
}
public function dunk(){
echo "Dunking\n";
}
public function pass(){
echo "Passinging\n";
}
}
$jordan = new NbaPlayer();
$jordan->name="Jordan";
$jordan->height="198cm";
$jordan->weight="92kg";
$jordan->team="Bull";
$jordan->playerNumber="23";
echo $jordan->name."\n";
?>
恩恩,这才是真正的类
PHP面向对象编程
70146 学习 · 361 问题
相似问题