Created
June 23, 2014 04:20
-
-
Save shin1x1/c4b8ce1f31fabea1a95f 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 Foo | |
{ | |
protected $name = ''; | |
public function __construct($name) | |
{ | |
$this->name = $name; | |
} | |
public function getName() | |
{ | |
return $this->name; | |
} | |
} | |
class Foo2 extends Foo | |
{ | |
public function getName($addedParameter) | |
{ | |
return parent::getName() . $addedParameter; | |
} | |
} | |
$foo = new Foo('Mike'); | |
var_dump($foo->getName()); | |
$foo = new Foo2('Mike'); | |
var_dump($foo->getName('!!')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment