Let's first create
parent
and
grandparent
clases
class A {
public static function who() {
echo __CLASS__;
}
}
class B extends A {
public static function who() {
parent::who();
}
}
One way to call grandparent's
who
method is to use the grandparent class name
A
class C extends B {
public static function who() {
A::who();
}
}
C::who();
Another way is to call
who
method of parent class which also calls its parent class (which is grandparent for
C
class)
class C extends B {
public static function who() {
parent::who();
}
}
C::who();