PHP Interview Question Answers List:
Q: What is inheritance in PHP?
Inheritance is a mechanism in which we can inherit the properties and methods of one class into another. This helps us to create a new class that will have its own properties and methods and all the features of its parent class(from which the new class is inheriting features). While performing inheritance you will see two kinds of classes as follow:
- Parent Class: The which being inherit.
- Child Class: The class which is inheriting features of another class:
Q: What are available types of inheritance in PHP?
There is a total of three types of inheritance available in PHP. Which are as follow:
- Single Inheritance
- Multilevel Inheritance
- Hierarchical Inheritance