note 100990 deleted from language.oop5.inheritance by thiago
| From: | thiago@php.net | Date: | Fri, 19 Nov 2010 12:20:48 +0000 |
| Subject: | note 100990 deleted from language.oop5.inheritance by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174185@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
<?php
/* here is the simply exampleof multiple inherinace */
class foo {
protected $mam = 'mamam';
function __construct() {
echo 'foo';
}
}
class bar extends foo {
function __construct() {
parent:: __construct();
echo 'bar';
}
}
class foobar extends bar {
private static $start;
public static function getInstance() {
if (self::$start == NULL) {
self::$start = new foobar();
}
return self::$start;
}
function __construct() {
parent::__construct();
echo 'foo bar';
echo $this -> mam;
}
}
foobar::getInstance();