PHP OOPs Concepts

Multilevel and Multiple inheritance 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.

Recommended Tutorials for you


Related posts

Learn How to Develop Object Oriented Programming Concepts in PHP

Anuj Kumar

PHP CRUD Operations using PHP OOP and MYSQL

Anuj Kumar

Chaining methods and properties

Anuj Kumar

Basics Of OOPs in PHP

Anuj Kumar

Polymorphism in PHP

Anuj Kumar

How to create classes and objects?

Anuj Kumar

The __construct() magic method

Anuj Kumar

What are exceptions and how to handle them?

Anuj Kumar

Access modifiers: public vs. private

Anuj Kumar

4 comments

Abhishek November 10, 2018 at 8:20 am

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

Reply
Anand jain November 10, 2018 at 6:18 am

WOW just what I was searching for.

Reply
Anand jain December 15, 2015 at 7:22 pm

WOW just what I was searching for.

Reply
Abhishek November 27, 2015 at 5:51 pm

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

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.