Situation:
class A extends etc { public function init() { parent::init(); //... } } class B extends A { public function init() { parent::init(); //... } } class C extends B { public function init() { parent::init(); //... } } I need to execute the init () method in C but in such a way that parent :: init () (parent method) is not executed, but all the other init () along the inheritance chain are executed.
those. the init () method was executed in C and then in A and then everything went along the chain. How can I skip the execution of the init () method in B without changing it?
UPDATE: forgot an important detail. we don't know the name of the progenitor class
UPDATE 2: Why did such an idea even appear: Php. Modification of class logic during initialization and parents
A::init(), however, it is not worth theCclass to know about the details of the hierarchy structure. - user236014public function init($bypass = false) { parent::init(); if (!$bypass) { //.. } }public function init($bypass = false) { parent::init(); if (!$bypass) { //.. } }, and in classСpass the parameter that you do not want to use it$bypassPapa = true; parent::init($bypassPapa);$bypassPapa = true; parent::init($bypassPapa);- Oleksandr