Python path-Object oriented

Source: Internet
Author: User

I. Object-oriented

1. Object-oriented and process-oriented comparisons

The process of focusing on the problem-solving procedure is a mechanical way of thinking, which is realized by pipelining.

Object-oriented objects are a combination of features and skills, and object-oriented is a simulation of the real world, like

God creates the world.

Process-oriented advantages can be complex problems of the process, simplification, the advantages of object-oriented is strong scalability.

2. Classes and objects

Class and object relationships: A class is a combination of a series of object-similar features and skills.

The real world: existing specific objects---------------"Summary of similarities------------" formation of the class

Program: Define class--------------call class to produce object

Example:

Note: 1. Classes and functions are different, classes are executed during the definition phase, and namespaces are generated and viewed with _dict_

2. Class name parentheses, which produce an object of a class, is called instantiation

3. Inheritance of Classes

4. Characteristics of Inheritance:

1. Resolves a problem where class and class code are duplicated.

2. Derive the new attribute in the subclass, whichever is your own.

3. Reuse the functionality of the parent class within a new method derived from the subclass: Call People._init_ directly

Python path-Object oriented

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.