Multilevel and Multiple inheritances in PHP

PHP does not support multiple inheritance. PHP supports multileve inheritance. Child class class can’t inherit by more than one parent class. But Parent class inherit the properties of prand parend class and grand child can inherit the properties of parent class.
 Multiple inheritance in PHP

class class
{
// body
}
class class1
{
// body
}
class class3 extends class class1
{
// body
}

This code will not work in php because PHP does not support multiple Inheritance.
Multilevel inheritance in PHP

class class 1
{
// body
}
class class2  extends class1
{
// body
}
class class3  extends class2
{
// boddy
}

In the given example class2 inheriting the class1 and class3 inheriting the class2. So class3 have  some properties of class2 and some properties of class1.

Leave A Reply

Your email address will not be published.

4 Comments
  1. Abhishek says

    I am regular visitor, how are you everybody? This paragraph posted at this site is genuinely fastidious.|

  2. Anand jain says

    WOW just what I was searching for.

  3. Anand jain says

    WOW just what I was searching for.

  4. Abhishek says

    I am regular visitor, how are you everybody? This paragraph posted at this site is genuinely fastidious.|

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy