Class Member Binding in PHP : Inheritance « Class « PHP
- PHP
- Class
- Inheritance
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();
?>
Related examples in the same category