1 Star 0 Fork 0

Paul / php_best_practice_code

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1_7_mobile.php 506 Bytes
一键复制 编辑 原始数据 按行查看 历史
<?php
/**
* 继承拥有比组合更少的代码量
* Created by PhpStorm.
* User: Administrator
* Date: 2017/6/24
* Time: 17:29
*/
class Car
{
public function addoil()
{
echo "Add oil\r\n";
}
}
class Bmw extends Car
{
}
class Benz
{
public $car;
public function __construct()
{
$this->car = new Car();
}
public function addoil()
{
$this->car->addoil();
}
}
$bmw = new Bmw();
$bmw->addoil();
$benz = new Benz();
$benz->addoil();
1
https://gitee.com/paultest/php_best_practice_code.git
git@gitee.com:paultest/php_best_practice_code.git
paultest
php_best_practice_code
php_best_practice_code
master

搜索帮助