标签:int extend class tor struct nbsp 对象 ons bsp
<?php
/**
 * Created by PhpStorm.
 * User: fu
 * Date: 2017/7/13
 * Time: 13:34
 */
class Person{
    public $name;
    public $age;
    public function __construct($name, $age)
    {
        $this->name = $name;
        $this->age = $age;
    }
public function desc(){
    }
    public function introduce(){
        echo ‘姓名:‘.$this->name.‘,年龄:‘.$this->age;
        $this->desc();
    }
}
class Man extends Person{
    public function desc(){
        echo ‘,男性有胡子<br>‘;
    }
}
class Woman extends Person{
    public function desc(){
        echo ‘,女生喜欢购物<br>‘;
    }
}
$person = new Man(‘李四‘, 25);
$person->introduce();
$person = new Woman(‘丽丽‘, 28);
$person->introduce();
标签:int extend class tor struct nbsp 对象 ons bsp
原文地址:http://www.cnblogs.com/zxy945/p/7162053.html