PHP extends类继承代码示例:
- < ?php
- class a{
- public $x;
- public $y;
- function __construct($x=0,$y=0){
- $this->x=$x;
-
$this->y=$y;
- }
- function getx(){
-
return $this->x;
- }
- function gety(){
-
return $this->y;
- }
- function __destruct(){}
- }
- class a2 extends a{}
/*extends是一个继承函数*/ -
$b2=new a2(10,10);
-
echo $b2->getx()."<br>";
-
echo $b2->gety();
-
?>
以上介绍的内容就是PHP extends类继承的全部实现步骤。
http://www.bkjia.com/PHPjc/446027.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/446027.htmlTechArticlePHP extends类继承代码示例: ?php classa{ public$x; public$y; function__construct($ x = 0 ,$ y = 0 ){ $this- x =$x; $this- y =$y; } functiongetx(){ return$this- x; } functio...