Object-oriented (object oriented, OO) is the focus of the current computer industry, it is the mainstream of software development methods in the 90 's. Object-oriented concepts and applications have gone beyond programming and software development to a wide range. such as database system, interactive interface, application structure, application platform, distributed system, network management structure, CAD technology, artificial intelligence and other fields.
On the surface, the object-oriented term means to organize software into a series of discrete objects that combine data structure and behavior. This is different from previous software development methods where data structures and behaviors are loosely correlated. What are the exact characteristics of the OO approach? Academia is controversial, but generally they all contain four aspects: identity, Classification (classification), Inheritance (inheritance), polymorphism (polymorphism).
Identification: The data is quantified as a discrete, identifiable entity called an object. Each object has its own internal identity. In other words, even if all the properties are the same, two objects are different.
Category: Objects that have the same data structure (attributes) and behavior (operations) are grouped into a class.
Inheritance: Multiple classes are based on a hierarchical relationship, sharing properties and operations between classes (together called features).
Polymorphism: For different classes, the same operation can have different actions.
Object-oriented Basic Concepts:
(1) object.
object is anything people want to study, from the simplest integer to the complex aircraft can be regarded as an object, it can not only represent the specific things, but also can represent abstract rules, plans or events.
(2) The state and behavior of the object.
Object has a state, and an object describes its state with a data value.
Objects are also manipulated to change the state of an object, and the object and its actions are the behavior of the object.
The object implements a combination of data and operations that encapsulates data and operations in an object's unity
(3) class.
An abstraction of an object of the same or similar nature is a class. Therefore, the abstraction of an object is a class, the materialization of a class is an object, or it can be said that an instance of a class is an object.
A class has attributes, which are abstractions of the state of an object and use data structures to describe the properties of the class.
A class has an action, which is an abstraction of the object's behavior, described by the operation name and the method that implements the operation.
(4) The structure of the class.
There are several classes in the objective world, and there is a certain structural relationship between these classes. There are usually two main structural relationships, that is, the general-concrete structural relationship, the whole-part structural relationship.
① General--the concrete structure is called the classification structure, it can be said to be "or" relationship, or "is a" relationship.
② the whole--part structure is called the assembly structure, the relationship between them is a kind of "and" relationship, or "super-delegates a" relationship.
(5) Messages and methods.
The structure of communication between objects is called a message. In an object's operation, when a message is sent to an object, the message contains information that receives the object to perform some action. Send a message to include at least the name of the object that describes the message, the name of the message sent to the object (that is, the object name, the method name). The parameters are generally described, either as the name of the variable known to the object that knows the message, or as a global variable name known to all objects.