note 14542 deleted from keyword.extends by jimw

From: Date: Fri, 07 Dec 2001 20:36:11 +0000
Subject: note 14542 deleted from keyword.extends by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21937@lists.php.net to get a copy of this message
Another Polymorphical Example : BTW, is any feature to terminate virtual? <p> class parent { var $a, $b ; function parent($a, $b) { // nothing, never mind $this->a = $a ; $this->b = $b ; } function opa() // this fuction should do something polymorphically. { echo "parent.opa() called &lt;br&gt; [ < br >" ; $this->opb(); // this call is resolved to child::opb() echo "] < br >" ; } function opb() { echo "parent::opb() called < br >" ; echo "object is a ",get_class($this),"< br >;"; } } class child extends parent { function child($a, $b){ $this->parent($a, $b) ; } function opb() // overrides parent::opb() { echo "child::opb() called< br >" ; echo "object is a ",get_class($this),"< br >;" ; } } echo "<hr>"; $achild = new child("A","B") ; echo "calling child::opa() < br >" ; $achild->opa();

« previous php.notes (#21937) next »