Today we talk about object-oriented, well, it’s not that object, it’s this object.
Let’s start today’s content:
What is object-oriented:
It is to put data and data operation methods together as an interdependent whole - object. Abstract the common features of similar objects to form a class.
Most data in this class can only be processed using the methods of this class. The class relates to the outside world through a simple external interface, and objects communicate through messages. The program flow is determined by the user during use.
Explanation of terms:
Based on objects: Everything is Objects are programmed with the concept of objects.
Object-oriented programming:
Object: It is the thing that people want to study, not only It can represent concrete things as well as abstract rules, plans or events.
credBeGaya Object Attributes and behaviors:
Attributes: Use data values to describe its state
Behavior: Methods used to change the behavior of an object
#:
The abstraction of an object with the same or similar properties is a class. The abstraction of objects is classes. The embodiment of tiredness is called an object.
After talking about object-oriented, let’s talk about process-oriented
: Execute sequentially from top to bottom and seek refinement step by step; The program structure is divided into several basic modules according to functions, and these modules form a tree structure; the relationship between each module is as simple as possible and relatively independent in function;Each module is internally composed of sequence It consists of three basic structures: , selection and loop;
The specific method of modular implementation is to use programs. The program flow is determined when the program is written. After talking about so many conceptual issues, it is still a bit vague. Let’s write a method for related objects: 1. Create an object (1) Direct quantity It is better to create a dog object, the code is as follows:# uce in in in on in on in on in on in in on in ons in
##dog ="Td""汪汪汪"
constructor and factory pattern
:Constructor There is no return value, the factory mode requires a return value;
That’s it for today, I will update it tomorrow. . . .
The above is the detailed content of Summary of JavaScript object knowledge. For more information, please follow other related articles on the PHP Chinese website!