Multilevel and Multiple Inheritance in PHP – onlinecode
In this post we will give you information about Multilevel and Multiple Inheritance in PHP – onlinecode. Hear we will give you detail about Multilevel and Multiple Inheritance in PHP – onlinecodeAnd how to use it also give you demo for it if it is necessary.
Multilevel and Multiple Inheritance in PHP :
PHP OOP does not allow multiple inheritance, it allow only multilevel inheritance.
In simple word, subclass can not extend more than one super class.
But PHP allow hierarchical inheritance, Hierarchical inheritance means child can get property of their parent and parent can get property of grand parent, so in this way child can get also some property of their grand parent.
Best example of multiple inheritance in PHP
- class demo
- {
- //Your class body
- }
- class demo1
- {
- //Your class body
- }
- class demo3 extends demo1 demo2
- {
- //your class body
- }
class demo{//Your class body}class demo1{//Your class body}class demo3 extends demo1 demo2{//your class body}