Created
January 21, 2020 17:52
-
-
Save INDIAN2020/a8058faa64f4a7d7adc8be6f6587eb24 to your computer and use it in GitHub Desktop.
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
class ParentClass { | |
function test() { | |
self::which(); // output 'parent' | |
$this->which(); // output 'child' | |
} | |
function which() { | |
echo 'parent'; | |
} | |
} | |
class ChildClass extends ParentClass { | |
function which() { | |
echo 'child'; | |
} | |
} | |
$obj = new ChildClass(); | |
$obj->test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment