OOP thinking refers to object-oriented programming. Object-oriented emphasizes the "abstraction", "encapsulation", "inheritance" and "polymorphism" of objects. Compared with process-oriented, this idea focuses on some methods of using objects. To solve problems, different functions may be solved by different objects.
Classes and Objects
Class: A class is an abstract concept, a class of things with the same characteristics General term, such as college students;
Object: The object is the entity of a specific thing, such as a specific student Zhang San.
Three major characteristics of object-oriented
1. Encapsulation
Encapsulation means that a class can have some private properties and methods, which can solve a problem The solution is encapsulated and only a part of the interface is provided to the outside world. The problem can be solved by calling the interface, but the outside world does not know what the specific solution is.
2. Inheritance
A class can obtain the non-private properties and methods of another class through inheritance, so that the properties and methods of the inherited class can be reused.
3. Polymorphism
Child objects instantiated by the same parent class can get different results by calling the same method. This is polymorphism.
Seven Design Principles
SOLID Principle
Single Responsibility Principle: Only one class/interface/method can have one and only one responsibility;
Open-Closed Principle: Open to expansion, closed to modification;
Richter Substitution Principle: All places that reference a base class must be able to transparently use objects of its derived classes;
Interface isolation principle: users cannot be forced to rely on interfaces they do not use. Using multiple interfaces is better than using one total interface;
Dependency inversion principle:
A. High-level modules do not Should depend on low-level modules, both should depend on abstraction
B. Abstraction should not depend on details, details should depend on abstraction. C. Program for interfaces, not for implementation
Di Mitte's Law: A software entity should interact with other entities as little as possible
Principle of combination reuse: Try to use combination/aggregation, do not use class inheritance
Recommended tutorial :《PHP》
The above is the detailed content of What does OOP thinking refer to?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools
