note 77852 deleted from language.oop by nlopess

From: Date: Sun, 16 Sep 2007 09:47:32 +0000
Subject: note 77852 deleted from language.oop by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-130533@lists.php.net to get a copy of this message
Note Submitter: kyle *dot* florence *at* gmail *dot* com ---- Seems you can't access a class object from the parent class in the extended class. Is this a bug? Is there a work-around? <?php $a = new A(); $c = new C(); class A { var $b; function A() { $this->b = new B(); $this->b->say(); // Works } } class B { var $say; function B() { $this->say = 'wee'; } function say() { echo "saying: ". $this->say; } } class C extends A { function C() { $this->b->say(); // Throws error "Call to a member function on a non-object" } } ?>

« previous php.notes (#130533) next »