1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 04:20:39 +02:00

Merge pull request #2815 from pofigizm/patch-1

[php/ru] delete repetition
This commit is contained in:
Andre Polykanine A.K.A. Menelion Elensúlë
2017-08-23 01:57:16 +03:00
committed by GitHub

View File

@@ -687,45 +687,6 @@ use My\Namespace as SomeOtherNamespace;
$cls = new SomeOtherNamespace\MyClass();
*//**********************
* Позднее статическое связывание.
*
*/
class ParentClass
{
public static function who()
{
echo "I'm a " . __CLASS__ . "\n";
}
public static function test()
{
// self ссылается на класс в котором определен метод.
self::who();
// static ссылается на класс в котором метод вызван.
static::who();
}
}
ParentClass::test();
/*
I'm a ParentClass
I'm a ParentClass
*/
class ChildClass extends ParentClass
{
public static function who()
{
echo "But I'm " . __CLASS__ . "\n";
}
}
ChildClass::test();
/*
I'm a ParentClass
But I'm ChildClass
/**********************
* Позднее статическое связывание.