http://www.51zxw.net/study.asp?vip=4857021
<?php
header("Content-Type:text/html;charset=UTF-8");
//面向对象的特点:继承、封装、多态
class Person{
public $userName;
public $age;
public function eat(){
echo '人都要吃饭!';
}
}
//继承:extends(php是单继承,只能继承一个)
class Student extends Person{
}
$XiaoMing = new Student();
$XiaoMing->eat(); //人都要吃饭!
?>