What is object-oriented, process-oriented and object-oriented difference

Talk about difference, First we have to figure out what to do is process-oriented, what is object-oriented.

Process-oriented is to analyze the steps required to solve the problem, then use the function to implement these steps, step by step, when used in a call to a turn on it.

For example, the elephant in the refrigerator, the first step you need to open the refrigerator, put in the elephant the second step, the third step on the refrigerator off, thus completing the elephant in the fridge this matter. This is process-oriented.

 

Object-oriented is to be a problem down into its affairs objects, the object was not intended to establish a complete step, but a thing to Miao Xu behavior throughout the problem-solving steps in.

Or the elephant in the fridge, we must first have a fridge, there is an elephant, you can switch the refrigerator, elephants can move, this time we come back to do the elephant in the fridge this matter.

 

This looks as if it makes no difference, but rather process-oriented to some of the organized, and more convenient way. This is just another seems simple on this matter only, if the boss is not going to make you a magnified image, but to let you go build a rocket it? Rocket science, but a big project, how to build, where to build, Are we, as a step by step process for listing the steps it?

Thus, for smaller issues, process-oriented simpler, more suitable for solving large-scale object-oriented problems.

Object-oriented programming is based unit, is a unit of process-oriented programming functions (methods)

 

Go into the details of object-oriented

The face of the nature of object-oriented programming: to organize the code class, the object of a way to organize data

 

Object-oriented programming (OOP) in three main characteristics of the subject clearly needs:

1, the behavior of objects ----- What can be applied to an object, or what methods can be applied to the object?

2, the state of the object ----- when applying those methods, the object how to respond?

3, object identity -------- how to identify different objects with the same behavior and state?

 

Encapsulation, inheritance and polymorphism are three basic features of object-oriented.

Package: The composition and behavior data in one packet, and the user hides the implementation of the object data is a black box.

(Called instance data in the object field, the behavior of the operation data is called method.)

Inheritance : to create a class of another process by extending a class. Vernacular that is, the subclass inherits the parent class, direct access to the properties and methods of the parent class

Polymorphic : subclass object can be assigned directly to the parent object, the runtime still showed characteristic behavior subclass

 

Published 38 original articles · won praise 6 · views 1905

Guess you like

Origin blog.csdn.net/weixin_43827227/article/details/101358622