Python---Object-oriented programming-1

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.