Created
July 29, 2013 13:54
-
-
Save mishak87/6104453 to your computer and use it in GitHub Desktop.
PHP witch craft at its best?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A { | |
public function callProtectedFunctionOfInstanceOfClassDescendant() | |
{ | |
echo (new B)->protectedFunction(); | |
} | |
} | |
class B extends A { | |
protected function protectedFunction() | |
{ | |
return '1'; | |
} | |
} | |
(new A)->callProtectedFunctionOfInstanceOfClassDescendant(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment