note 75968 added to keyword.paamayim-nekudotayim

From: Date: Mon, 25 Jun 2007 02:42:31 +0000
Subject: note 75968 added to keyword.paamayim-nekudotayim
Groups: php.notes 
Request: Send a blank email to php-notes+get-127936@lists.php.net to get a copy of this message
I revised this example to give a better feel for the scope and overloading rules in PHP 4. <?php class A { function example() { echo "I am the original function A::example().<br />\n"; $this->other(); } function other() { echo "I am the original function A::other().<br />\n"; } } class B extends A { function example() { echo "I am the redefined function B::example().<br />\n"; A::example(); } function other() { echo "I am the redefined function B::other().<br />\n"; } } // there is no object of class A. // this will print // I am the original function A::example().<br /> // PHP Fatal error: Call to a member function on a non-object in test.php on line 5 A::example(); // create an object of class B. $b = new B; // this will print // I am the redefined function B::example().<br /> // I am the original function A::example().<br /> // I am the redefined function B::other().<br /> $b->example(); ?> Robert Chapin Chapin Information Services ---- Server IP: 208.69.120.35 Probable Submitter: 68.255.82.5 ---- Manual Page -- http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php Edit -- https://master.php.net/note/edit/75968 Del: integrated -- https://master.php.net/note/delete/75968/integrated Del: useless -- https://master.php.net/note/delete/75968/useless Del: bad code -- https://master.php.net/note/delete/75968/bad+code Del: spam -- https://master.php.net/note/delete/75968/spam Del: non-english -- https://master.php.net/note/delete/75968/non-english Del: in docs -- https://master.php.net/note/delete/75968/in+docs Del: other reasons-- https://master.php.net/note/delete/75968 Reject -- https://master.php.net/note/reject/75968 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127936) next »