|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-02-25 13:12 UTC] moriyoshi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
<? class class_root { var $a; var $b; function class_root() { echo get_class($this)." Created<br>"; } } class db_class extends class_root { var $owner; function db_class($ow) { $this->class_root(); $this->owner=$ow; } } class adm_class extends class_root { var $owner; function adm_class($ow) { $this->class_root(); $this->owner=$ow; } function kkk() { echo get_class($this->owner)."<br>"; echo get_class($this->owner->adm)."<br>";//Undefined ??? ... must be object echo get_class($this->owner->db)."<br>";//Undefined ??? ... must be object $this->owner->adm->kkk(); } } class super_class extends class_root { var $s; var $adm; var $db; function super_class() { $this->class_root(); $this->adm=new adm_class(&$this); $this->db=new db_class(&$this); } } $sc=new super_class(); $sc->adm->kkk(); echo '-------'; ?> results: super_class Created adm_class Created db_class Created super_class Fatal error: Call to a member function on a non-object in bla-bla-bla\1.php on line 35 PHP works as apache2 module