Current location - Health Preservation Learning Network - Slimming men and women - Which sweatpants are better than Zhihu?
Which sweatpants are better than Zhihu?
There are several categories of sweatpants that are only suitable for you, and there is a certain structural relationship between them. There are usually two main structural relationships, namely, general-concrete structural relationship and whole-part structural relationship.

① General-concrete structure is called classified structure, which can also be said as "or" relationship or "is a" relationship.

② The whole part structure is called assembly structure, and the relationship between them is an AND relationship or A has a relationship.

(3) Object

The object is anything that people want to study, from the simplest integer to the complex airplane. It can represent not only concrete things, but also abstract rules, plans or events.

(4) the state and behavior of the object

An object has a state, and the object describes its state with data values.

Objects also have operations to change the state of objects, and objects and their operations are the behaviors of objects.

Object realizes the combination of data and operation, so that data and operation are encapsulated in the unity of object.

(5) Information and methods

The communication structure between objects is called message. In the operation of an object, when a message is sent to an object, the message contains information that the receiving object will perform some operation. Sending a message should at least include the name of the object receiving the message and the name of the message sent to the object (that is, the object name and the method name). Usually, it is necessary to explain parameters, which can be variable names known to the object that knows the message or global variable names known to all objects.

trait

(1) object uniqueness

Each object has its own unique identifier, through which the corresponding object can be found. In the whole life cycle of an object, its logo will not change, and different objects cannot have the same logo.

(2) Classification

Classification refers to the abstraction of objects with consistent data structure (attributes) and behavior (operations) into classes. Class is such an abstraction, which reflects the important attributes related to the application and ignores other irrelevant contents. The division of any class is subjective, but it must be related to the specific application.

(3) Inheritance

Inheritance is the mechanism by which subclasses automatically share the data structure and methods of the parent class, and it is the relationship between classes. When defining and implementing a class, you can do it on the basis of an existing class, take the content defined by this existing class as your own content, and add some new content.

Inheritance is the most important feature that distinguishes object-oriented programming languages from other languages, which other languages do not have.

In the class hierarchy, subclasses only inherit the data structures and methods of a parent class, which is called single inheritance.

In the class hierarchy, subclasses inherit the data structures and methods of multiple parent classes, which is called multiple inheritance.

In software development, class inheritance makes the established software open and extensible, which is an effective method of information organization and classification. It simplifies the workload of creating objects and classes and increases the repeatability of the code.

By adopting inheritance, the hierarchical structure of class specification is provided. Through the inheritance of classes, we can share common characteristics and improve the reusability of software.

(4) Polymorphism

Polymorphism means that the same operation or function or process can act on many types of objects and get different results. Different objects will produce different results when they receive the same message. This phenomenon is called polymorphism.

Polymorphism allows each object to respond to the same message in its own way.

Polymorphism enhances the flexibility and reusability of software.

key element

(1) Summary

Abstraction is to emphasize the essence and inherent attributes of entities. In system development, abstraction refers to the meaning and behavior of an object before deciding how to realize it. Using abstraction can avoid premature consideration of some details.

Class realizes the abstraction of data (i.e. state) and behavior of an object.

(2) encapsulation (information hiding)

Encapsulation is the basis of ensuring good modularity of software components.

The object-oriented class is a well-packaged module. The class definition clearly separates its description (external interface visible to users) from its implementation (internal implementation invisible to users), and its internal implementation provides protection according to the scope of its specific definition.

An object is the most basic unit of encapsulation. Encapsulation prevents the influence of changes caused by program interdependence. Object-oriented packaging is clearer and more powerful than traditional language packaging.

(3)*** Enjoy

Object-oriented technology promotes the enjoyment of * * * at different levels:

(1) Enjoy the same category.

Objects in the same class have the same data structure. These objects have a * * * sharing relationship in structure and behavior characteristics.

② Enjoy in the same application.

In the class hierarchy of the same application, there is data structure and behavior inheritance between similar subclasses with inheritance relationship, which makes all similar subclasses * * * enjoy the same structure and behavior. Using inheritance to enjoy the code is also one of the main advantages of object-oriented.

③ Enjoy in different applications.

Object-oriented not only allows information to be shared in the same application, but also prepares the conditions for the reusable design of future goals. Through the mechanism and structure of class library, information sharing in different applications can be realized.

(4) Emphasize the object structure rather than the program structure.

Development method

The research of object-oriented development method is becoming more and more mature, and many object-oriented products have appeared in the world. Object-oriented development methods include Coad method, Booch method and OMT method.

(1)Booch method

Booch first describes the basic problems of object-oriented software development method, and points out that object-oriented development is a design method that is fundamentally different from traditional functional decomposition. Object-oriented software decomposition is closer to people's understanding of objective affairs, while functional decomposition can only be obtained through the transformation of problem space.

(2)Coad method

Coad method is an object-oriented development method proposed by Coad and Yourdon in 1989. The main advantage of this method is that through the organic combination of many years of large-scale system development experience and object-oriented concept, a set of systematic principles are put forward in the identification of objects, structures, attributes and operations. This method completes the further identification of classes and class hierarchies from the perspective of requirements. Although Coad method does not introduce the terms of class and class hierarchy, in fact, the entities that have been formed in classification structure, attributes and data encapsulation are objects. An object is an instance of a class. Some objects are alive and some are dead. In real life, an entity is an object, such as a person, a balloon, a computer and so on. For example, this car, this person, this house, this table, this plant, this check, this raincoat. To sum up, everything is an object. In object-oriented programming, the object is the basic running entity in the system and the collection of code and data. [2] Anything meaningful in the application field and related to the problem to be solved can be taken as an object, which can be an abstraction of a concrete physical entity, an artificial concept, or