Created
July 25, 2016 01:46
-
-
Save markzz/65a766b42fb135d299cb19eb00450116 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
<?php | |
class ParentClass { | |
function __construct() { | |
$this->self_define(); | |
} | |
function self_define() { | |
$this->foo = 'test'; | |
} | |
} | |
class ChildClass extends ParentClass { | |
function __construct() { | |
parent::__construct(); | |
} | |
function self_define() { | |
$this->foo = 'another'; | |
} | |
} | |
$c = new ChildClass(); | |
echo $c->foo . "\n"; // prints "another" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment