How to declare Inheritance in PHP with example?

What is Inheritance?:-
Inheritance means one class method or properties access to another class. The child class will inherit all public, private, protected methods or properties from the parent class.

Public Access Modifier:-

Output

Private Access Modifier:-

Output

Protected Access modifier :-

Output
Rajesh Kumar
Follow me