C ++ object-oriented programming study notes (1)

###basic concepts

Object ####: object-oriented programming, objects are described which data entity attributes and a set of operations on the data applied to the package together configuration, each object is composed of two parts of the operation code and data .

Class ####: object-oriented programming in the same class is a collection of data and a set of objects of the same operation, a description of a class of objects having the same data structure and the same operation. C ++ class data referred to as data members, the operation by the function class is implemented, these functions are called member function.

The relationship between the object and the class is abstract and concrete relationship. A plurality of class objects integrated abstract result, an object is an instance of a class.

#### message and methods: the object-oriented programming, links between objects are called interactive objects, object-oriented programming techniques must provide a mechanism that allows objects to interact with a another object, such a mechanism is called messaging, request sent to one object to another object called a "message." Messaging in object-oriented programming is actually a direct simulation of the real world of messaging. Function call object is to deliver a message to the object, the object is required to achieve a certain behavior. Objects can achieve behavior, called in program design methods, they are by calling the appropriate functions that are implemented in the C ++ language is through member functions to achieve.

###Basic Features

Abstract ####: abstract concept is taken after the process of forming the common properties through specific examples. Object-oriented programming are two aspects of the abstract: Abstract codes and data abstraction (or abstract behavior). The former describes some state of the object or attribute, wherein the physical quantity is different from each other such object class of the object, which describes certain common behavioral characteristics of the object or having a common function. In the design method for object-oriented programs, the result of a specific problem abstract analysis is described and implemented by the class.

Package ####: the object-oriented programming, the package refers to the operation and implementation of the data code together on the interior of the object, and the internal details of possible hidden object. Object-oriented programming in the use of an object, the user interface can only be operated outside it through the object, the function name is the object of the object's external interface to the outside world can call these functions by name function name to achieve a certain behavior.

#### Inheritance: Inheritance is expressed by the relationship between the related object classes, inheritance mechanism allows a derived class inherits the base class data and operations. That is, the derived class uses to allow operation and data base class, while the derived class can add new operations and data. Inherited from the source, into a single inheritance and multiple inheritance, a single inheritance means that each derived class inherits directly only feature a base class, multiple inheritance refers to a plurality of base class inheritance of a derived class.

#### Polymorphism: polymorphism in object-oriented systems to perform different operations refers to different objects receive the same message. Run-time polymorphism and polymorphism when the C ++ language allows two polymorphisms, and compiled. Compile-time polymorphism is achieved by function overloading, runtime polymorphism is achieved by means of virtual functions.

Guess you like

Origin www.cnblogs.com/springfield-psk/p/11753213.html