One code sample I have got from a website, but it was difficult for me to understand the output. I am sharing the code :
class A
{
public static function foo()
{
static::who();
}
public static function who()
{
echo __CLASS__."\n";
}
}
class B extends A
{
public static function test()
{
A::foo();
parent::foo();
self::foo();
}
public static function who()
{
echo __CLASS__."\n";
}
}
class C extends B
{
public static function who()
{
echo __CLASS__."\n";
}
}
C::test();
The Output is as follows ::
A
C
C
I would be highly helped if the above output is explained. Thanks in Advance.