Oldboy 21th Day. I Love Python. Object-oriented encapsulation, polymorphism, inheritance three major features

Source: Internet
Author: User

First, the main content:
Interface class: ( Only in the work, writing a specification.)

Abstract class:
Usefulness: At work, if you prescribe several classes, you must have the same method, if you are abstract class.

Packaging:
1, put some properties or methods (some useful information) in a space.

2, Private member encapsulation: private static variable, private property, Private method feature: +__ double underline before variable, and outside class, subclass accesses private variable, private method is inaccessible. Because the private member, at run time, will become: _ Class name __ variable name so you are outside of the class, or the derived class is inaccessible.
Some methods, variables, properties, are used only within the class, are not allowed outside of the class, or are called in a derived class.

The overall classification of the class:
The first part:
public static fields
private static fields
Part II:
Special method: __INIT__,__STR__, etc.
Common methods:
Private methods:
Class method:
Property:

Oldboy 21th Day. I Love Python. Object-oriented encapsulation, polymorphism, inheritance three major features

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.