PHP-面向对象

2019-04-21  本文已影响0人  AGEGG

php类权限控制修饰符
public//类的内部,类的外部,子类使用
protected//类的内部,子类
private//类的内部

面向对象的封装
成员访问权限

面向对象的继承
单一继承
方法重写

Class Father
{
  public function test() {}
}

Class Son extends Father
{
   public function test(){//子类重写父类test()
    parent::test();//使用父类test()
}
 }

面向对象的多态
抽象类的定义
接口的定义

魔术方法

___construct()
__destruct()
__call()
__callStatic()
__get()
__set()
__isset()
__unset()
__sleep()
__wakeup()
__toString()
__clone()

设计模式
工厂模式
单例模式
注册树模式
适配器模式
观察者模式
策略模式

方法名和类名一致,也是构造函数
上一篇 下一篇

猜你喜欢

热点阅读