note 113412 deleted from language.oop5.decon by levim
| From: | levim@php.net | Date: | Tue, 18 Mar 2014 02:06:35 +0000 |
| Subject: | note 113412 deleted from language.oop5.decon by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198912@lists.php.net to get a copy of this message | ||
Note Submitter: Nanhe Kumar
----
<?php
// This program uses inheritance to extend Box.
class Box {
public $width;
public $height;
public $depth;
// construct
public function __construct($width = NULL, $height = NULL, $depth = NULL) {
$this->width = $width;
$this->height = $depth;
$this->depth = $height;
}
public function volume() {
return $this->width * $this->height * $this->depth;
}
}
class BoxWeight extends Box {
public $weight; // weight of box
public function __construct($width = NULL, $height = NULL, $depth = NULL, $weight = NULL) {
parent::__construct($width, $height, $depth);
}
}
$bw = new BoxWeight(10, 20, 15, 34.3)
?>