Multilevel Inheritance

In multilevel, one-to-one ladder increases. Multiple classes are involved in inheritance, but one class extends only one. The lowermost subclass can make use of all its super classes’ members. Multilevel inheritance is an indirect way of implementing multiple inheritance. Following program explains.

Example

<?php
class a
{
public function function_a(){
echo “class A”;
}
}

class b extends a
{
public function function_b(){
echo “class B”;
}
}

class c extends b
{
public function function_c(){
echo “class c”;
}
}

echo c::function_c();
echo c::function_b();
echo c::function_a();

?>

Share