Website And Mobile Application Development Company In India



Collection of function(methods) and variable to perform particular task.

Object is instance of class, to use methods and variable of class out side the class.

  • Inheritance
  • Abstraction
  • Encapsulation
  • Polymorphism

There are 3 types of visibility to control methos and variable in php.

  • Public
  • Protected
  • Private

Static methos and variable directly access out site class without create object of that class using ::(scope resolution operator).

- Using inheritance you can access property or methods of one class to another class.

- In PHP multilevel inheritance is possible but multiple inheritance is not possible. In simplified terms in php child class can not inherit more than one parent class.

- But hierarchical inheritance possible, parent access grand parent property and grand child access property of parent class.

We can not create object of abstract class, but inherit class and use methods of abstract class.

- Interface same as abstract class, we can't create object of interface class but we implement interface class to another class.
- All methods declared in an interface must be public, this is the nature of an interface. To implement an interface, the implements operator is used.
- Interface class method are define only but it declare out side class where it implement.
- Interface support multiple inheritance

How you visible private and protected method and variable out side class is called encapsulation.

Single interface with multiple implementation is call polymorphism