General OOP concepts utilised as a part of PHP
Object Oriented Programming (OOP) is a programming idea that regards functions and information as objects. Object Oriented Programming ideas which expect everything as an object and execute a software utilising diverse items.
These are some Ideas of OOP-
- Abstract Class
- Access Specifiers
- Class and Object
1. Abstract Class-
An Abstract class is a class that is just halfway implemented by the programmer. An Abstract Method is basically a function definition that serves to tell the programmer that the strategy must be actualized in a child class.
In PHP, Abstract Class and Abstract Method are used frequently. We can make an abstract class by utilising the decisive word – ‘abstract’.
2. Access Specifier-
To Restrict the entrance over the projects we have 3 sorts of access specifiers-
A Public specifier permits the outside world to access change the information individuals straightforwardly not at all like the private access specifier. A public specifier gives the minimum insurance to the interior data members and member functions.
A Private specifier is utilised to shroud the information part or member function to the outside world. It means that just the class that determines such data part and member functions have access to them.
A Protected access specifier is principally utilised with inheritance. A Protected data member is open for the class that announces it and its child class; yet is private for whatever is left of the project.
3. Class and Object-
A Class is an outline for an object & an Object encapsulates thoughtfully related State and Responsibility of something in your Application and ordinarily offers a programming interface with which to cooperate with these. This cultivates code reuse and enhances viability.
Inheritance depends on the rule of Parent-Child relationship.In PHP we accomplish inheritance by expanding the class. “When a class is characterised by acquiring the existing function of a parent class then it is called Inheritance”.
Expanding a class, the child class inherits the parent’s properties class.
The interface is an accumulation of meanings of some arrangement of routines in a class. An Interface ought to be actualized in the class and all the methods or functions ought to be overridden in this class.
Polymorphism means “ Numerous Structures” . Polymorphism is the capacity (in programming) to show the same interface for varying fundamental structures (information sorts).