Object-oriented includes 3 parts: Object Oriented Analysis (OOA), Object Oriented Design (OOD), and Object Oriented Programming (OOP). Two important concepts in object-oriented programming are classes and objects.
category
A class is a collection of variables and methods that act on these variables. Things have their own attributes and methods, and different substances can be distinguished through these attributes and methods. For example: people have attributes such as height, weight, fatness and skin color, and can also perform active activities such as eating, learning, and walking. These activities can be said to be functions of people. People can be regarded as a class in the program, then a person's height can be compared to the attributes in the class, and walking can be compared to the methods in the class. In other words, a class is a collection of attributes and methods, and is the core and foundation of object-oriented programming. Through classes, scattered codes used to implement a certain function can be effectively managed.
object
A class is an abstract model with a certain function. In practical applications, the class also needs to be instantiated, so that the concept of objects can be introduced. An object is the product of instantiation of a class and is an entity. Still taking human beings as an example, there is nothing wrong with the sentence "Yellow race people are human beings", but conversely, "Humans are yellow race people", this sentence must be wrong. Because in addition to yellow people, there are also black people, white people, etc. Then "yellow race" is an instance object of the "person" class. The relationship between objects and classes can be understood this way: the object is actually a class that is flesh and blood and can be touched and seen.
Three major characteristics of object-oriented programming
Object-oriented programming has three major characteristics: encapsulation, inheritance and polymorphism. Encapsulation can effectively avoid code coupling during programming, inheritance can effectively utilize code resources, and polymorphism can effectively improve code reusability.
Encapsulation:
Encapsulation can also be information hiding, which is to separate the use and implementation of a class, leaving only limited interfaces (methods) to communicate with the outside. For developers who use this class, they only need to know how to use this class, and do not need to care about how this class is implemented. Doing so allows developers to better focus on other things, while also avoiding the inconvenience caused by interdependencies between programs.
Inheritance:
Inheritance means that a derived class (subclass) automatically inherits the properties and methods in one or more base classes (parent classes), and can override or add new properties or methods. Inheritance simplifies the creation of objects and classes and increases code reusability. Inheritance is divided into single inheritance and multiple inheritance. PHP currently only supports single inheritance, that is, a subclass has one and only one parent class.
Polymorphism:
Polymorphism means that different objects of the same class can obtain different results using the same method. This technology is called polymorphism. Polymorphism enhances software flexibility and reusability.
It's just done by hand. If there are any shortcomings, please correct me. ').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
The above has introduced the basic concepts of object-oriented, including object-oriented aspects. I hope it will be helpful to friends who are interested in PHP tutorials.