Class Member Overloading

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

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.