Mega Code Archive

 
Categories / Php / Class
 

Class Member Binding in PHP

<?php      class ParentClass {           public function callMe() {                $this->anotherCall();           }           public function anotherCall() {                echo "Parent called!\n";           }      }      class ChildClass extends ParentClass {           public function anotherCall() {                echo "Child called!\n";           }      }      $child = new ChildClass;      $child->callMe(); ?>