Skip to content

Instantly share code, notes, and snippets.

@shin1x1
Created June 23, 2014 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shin1x1/c4b8ce1f31fabea1a95f to your computer and use it in GitHub Desktop.
Save shin1x1/c4b8ce1f31fabea1a95f to your computer and use it in GitHub Desktop.
<?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