Inheritance in PHP
Inheritance is the php oops concept which is based around the concept of base classes or superclasses and derived classes or subclasses.
Base classes or Super Classes are also known as parent classes and similarly, derived classes or subclasses are known as child classes.
In the real world as a child take features from their parents, Same way in oops, child class inherit properties of their parent class with the help of inheritance.
We use `extends` keyword to implement inheritance in php.
Advantage of using inheritance in php oops, we can share properties of one class to other class.
What is inheritance in PHP ?
Inheritance in php is nothing but a well-established programming principle.The class which is being extend by other class is known as parent class, and the class which extend other class is known as child class.
By using inheritance in php, we can re-use of our code in object model.
Which type of inheritance supports in php ?
In the example given below, the SportsCar class inherits the LuxuryCar class which means now child class `SportsCar` has ability to access all methods and properties of parent class `LuxuryCar` that are not private.