Everyone's object-oriented development to 10 minutes to understand object-oriented

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/zhanghaishan/article/details/90475886

Preface:  

  In fact, everyone will be object-oriented, in fact everyone are skilled in using object-oriented concepts. Now please take 10 minutes time for us to understand this so-called obscure difficult to understand object-oriented.

 

Direct lecture:

  A vernacular object-oriented generalization, please keep in mind that the object-oriented nature is: [ simulation of the real world in the virtual world ]. Object-oriented is not a technology , but a programmatic way , not the way a language is a separate possession.

  Everything Is an Object, Object why everyone will face it? Everyone's life, work and study are skilled in the use of object-oriented, all around us everything is an object (believe beginners will think this sentence is obscure and difficult), please follow my thinking to Study the concept.

  Life around us will be divided relatives, colleagues, lovers, as well as students and so on. We'll textbooks into books, comics, and we'll skilled distinguish cars, buses as well as a bicycle, that's right! ! ! This is the basic use of object-oriented. We just need skilled use of it we have this concept refer to our programming.

 

Early lead concept:

  Still have to cite an example, please look at [meditation simulate the real world in the virtual world ] look at this sentence this example, each of us will put all the people in the school are divided into different classes , and the class of people divided for the teachers and students . This simple classification is already the object-oriented use, while teachers and students are all human . I believe we all understand this classification. Now we need to simulate the real world in the virtual world.

  Now please prepared in accordance with the above classification of a class list system, teachers and students are human beings , human beings have their own gender , name , and the age , teacher 's title is divided language teacher, math teacher, the students then have a seat number. Each class has a class number , we will have proficiency in the use of this classification concepts to our object-oriented programming is the use of the above mentioned people, teachers, students have the name, age and so is programming us the property, which is a human teacher, the student is a subclass of people, we can mend the brain from top to bottom of a tree diagram, this figure is the inheritance tree, and finally map, first brains.

 

Advanced concepts:

  Object-oriented programming purpose is to better programming , the biggest advantage is that the program is more appropriate to make the program easier to write life, maintenance and reading, the most basic requirement is that when we use to meet the demand , not superfluous discuss sublimation business . Revisit a lot of beginners to understand object-oriented concepts, but in the use of fall into a blind spot, took the class in terms of the above example, some people will be hesitant and over-analyze to attributes, such as: human hair there color, eye colors, waist and so on, in fact, our business needs can be.

 

end:

  Over our participation in programming time, everyone has their own unique understanding of the use and when to use the object-oriented, welcome to leave comments or family to join our discussion, JAVA technology advanced discussions QQ group: 524 574 427.

  Finally, fill the tree view (in the absence of drawing tools, drawing tools welcome message or recommended in the group).

Guess you like

Origin blog.csdn.net/zhanghaishan/article/details/90475886