Skip to content

Instantly share code, notes, and snippets.

@markzz
Created July 25, 2016 01:46
Show Gist options
  • Save markzz/65a766b42fb135d299cb19eb00450116 to your computer and use it in GitHub Desktop.
Save markzz/65a766b42fb135d299cb19eb00450116 to your computer and use it in GitHub Desktop.
<?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