Late Static Binding
<?php
class Base
{
protected static $name = "Yahoo by self";
public function show()
{
echo self::$name . "<br>";
echo static::$name;
}
}
class Derived extends Base
{
protected static $name = "Hello World by static";
}
$test = new Derived();
$test->show();
// OUTPUT:
//Yahoo by self
// Hello World by static
?>
Comments
Post a Comment