- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain difference between Abstraction and Encapsulation in PHP.
PHP5 added the object-oriented programming approach with the previous version, which is used for making code reusable in real time php application.
Some of the concepts of object-oriented models are: class, object, encapsulation, polymorphism, abstract and final classes, and methods, interfaces and inheritance, etc...
Here we discuss the basic differences between abstraction and encapsulation.
- Encapsulation is an approach that joins data members(variables) and implementation details into a single unit called the class that implies class is formed with variables and methods present inside it.
- Encapsulation is a protection mechanism for data members present inside the class i.e data members are not accessible by end users.
- In encapsulation, the data members(variables) of a class will be not accessible by other classes and can be accessed only through the methods of their current class.
- Encapsulation is implemented using a private and protected access modifier.
- Encapsulation is used for reducing the complexity of a web application
Let's discuss Abstraction.
- The structure of representing necessary features without including the background details is specified as an abstraction.
- Abstraction is the technique of covering the implementation details from the end-user and only displaying the functionality to the users.
- Abstraction is utilized to execute polymorphic ideas with classes i.e With abstraction we can only declare the methods inside a class. usually, another derive class is used to describe the same methods.
- An abstract class cannot be instantiated so end-users can't directly access it.
- It is used to reduce the complexity of the application and make the code reusable in an application.
- Difference Between Abstraction and Encapsulation
- What is the difference between abstraction and encapsulation in Java?
- Explain Encapsulation in PHP.
- Abstraction vs Encapsulation in Java
- Difference Between Abstraction and Data Hiding
- Difference Between Data Hiding and Encapsulation
- PHP Class Abstraction
- Difference between Python and PHP.
- Difference Between PHP and Python
- Difference between !== and ==! operator in PHP
- Explain the Difference Between Definition and Declaration
- Explain the difference between Virus and Worm?
- Explain the difference between OLAP and OLTP