47. What are the characteristics of Python's inheritance in object-oriented?

Source: Internet
Author: User

Benefits of Inheritance :

1. Build the class in the system to avoid repetitive operation .

2, the new class is often based on existing classes, so that you can improve the code reuse degree .

Characteristics of inheritance :

1, the construction of the base class in inheritance (The __init__ () method) is not automatically called, it needs to be called specifically in the construction of its derived class. different from C #

2. When calling a method of a base class, you need to prefix the class name of the base class with the Self argument variable. Unlike calling a normal function in a class, you do not need to take the self argument

3, Python always first looks for a method of the corresponding type, and if it cannot find the corresponding method in the derived class, it begins to look up one by one in the base class. (Find the method that was called in this class before you can find it in the base class).

47. What are the characteristics of Python's inheritance in 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.