Abstract, interface

Source: Internet
Author: User

<?php

/*class Ren {public static $color;   static function Show () {Ren:: $color;   Self:: $color;  }} class Car {public static $name;   }*//*/abstract class Dongwu {public $dong;      Public $jiao; function Chi () {} function Shui () {}}

Interface Extreme abstract class interface dongwu//definition interface, do not add class {} class Ren extends Dongwu {} $d = new ren*//*//interface keywords; interface The method inside the interface does not have the function body//implements the interface to use the keyword; implements, subclasses that do not use extends//implement interfaces must implement each method of the interface

 //Interface extremely abstract class  interface USB { function Read ()  {     }   function W Rite ()   {       }  }   //mouse  class Mouse extends USB  {  function Read ()   {   echo "inserted mouse";    }     function write ()    {    echo "Power you to Mouse";     }    }     //Keyboard   class Jianpan implements USB   {    function Read ()   {   echo "inserted mouse";    }    function Write () & nbsp;  {    echo "Power you to the mouse";     }         $m = new Mouse ();    $m->read ();    $m->write ();   */

Class Ren {public $name;  Public $sex;  Public $age;   function run () {} function Show () {echo ' name stands for name, sex representative, age, and the Run method represents the method of running;  }//destructor function __destruct () {//The memory is freed before the object is destroyed, the connection is closed, etc. echo "the object destroyed"; }//When the output object is called, there must be a return value to perform function __tostring () {//return "name for name, sex representative, age for ages, and run method to represent the method of running" return $this->   ; name; }}//Special: _destruct//Execution Time Special: Execute/* At time of object destruction * $r = new Ren (); $r->name = "Zhang San"; Var_dump ($R); */* $r = new Ren (); echo $r; * *

Small knowledge points

/* $a = 10; $b = 20; $c = 25; Unset ($b); if (Isset ($b)) {echo $a + $b, echo $a * $c, echo $sun, echo "<br>", Echo $a * $sum;}

if (Isset ($b)) {echo ' variable B does not exist! "; Exit ();//Quit the program die ("variable B does not exist!") ");//Output error message and exit program} Echo $a + $b; Echo $a * $c; Echo $sun; echo "<br>"; Echo $a * $sum;

$attr = Array (1,2,3,4); $a = "Hello"; Var_dump ($ATTR); Print_r ($ATTR); Print_r ($a); echo "Hello", "AA"; print "VV";

?>

Abstract, interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.