zoukankan      html  css  js  c++  java
  • PHP抽象类

    <?php
    /*
     * abstract
     * 抽象类:
     * 1、至少有一个抽象方法(没有具体实现的方法)
     * 2、不能被实例化,可以被继承
     * 3、抽象类可以有子抽象类
     * 相对于接口:
     * 1、可以有属性
     * 2、一个子类只能继承一个抽象类,但是可以实现多个接口
     * 
     * 
     * */
     abstract class qian {
      abstract function getfirst();
      function gettwo() {
        echo "I am gettwo";
      }
     }
     abstract class jj extends qian {
      abstract function getthree();
     }
     class nan extends jj {
      function getfirst() {
        echo "I am getfirst";
      }
      function getthree() {
        echo "I am getthree";
      }
     }
     $nn = new nan();
     $nn->getfirst();
     $nn->gettwo();
     $nn->getthree();
    ?>
  • 相关阅读:
    Document
    Document
    Document
    Document
    Document
    Document
    8. vue 的生命周期
    7. vue-cli 安装和使用脚手架
    5.组件(2) 之 父级传子级
    6.组件(3) 之 子级传父级
  • 原文地址:https://www.cnblogs.com/sgm4231/p/9821958.html
Copyright © 2011-2022 走看看