In the following code, PHP will be unhappy that customMethod () is private. Why is this so? Is visibility defined where something is declared, not defined?
If I wanted customMethod to be only visible to a code template in the Template class and not allow it to be redefined, could I just make it secure and final?
template.php:
abstract class Template() { abstract private function customMethod(); public function commonMethod() { $this->customMethod(); } }
CustomA.php:
class CustomA extends Template { private function customMethod() { blah... } }
main.php
... $object = new CustomA(); $object->commonMethod(); ..
inheritance php abstraction
jontyc Oct 29 '11 at 1:30 p.m. 2011-10-29 13:30
source share