I write a blog is to better understand the Python programming, so the big guy skip to spray, if the wrong place to welcome guidance.
What is object-oriented programming?
A little bit of leather is still possible .... But the skin is tens of thousands of!
Now it's time to get into the theme, there are countless programming styles, but there are three of them, process oriented, function oriented and object oriented. The object programming is to describe the characteristics of a class of things, the characteristics of the programming method.
A chestnut: God does not want to do repetitive work when he makes people, so he uses an object-oriented approach to build people. He put the food and drink of people, talking, thinking and so on the method (function) written into a machine,
Then God can press the machine button and then lose a Zhang San name, and a Zhang San man will build it.
1. God's way of writing about people's eating and drinking, talking, thinking and so on is an object-oriented programming.
#!/usr/bin/python3#-*-coding:utf-8-*-class People: //Defines a People class Def chi ():p assdef He (): // Write functions with Functions Passdef speaking ():p assdef think ():p ass//This is an object-oriented programming
2. God is instantiating the object by pressing the machine button and then losing the name of a Zhang San.
Zhangsan=people () //Instantiate the object so that Zhang San has the function of eating, drinking, talking, thinking
This is just a simple understanding of what object-oriented programming is, and what I understand now. The following is a detailed explanation of the classic and new classes in Python, as well as the construction method, inheritance .... Wait a minute
Python---Object-oriented programming-1