python--Object-oriented (the foundation is all written, the next is the object-oriented, now you can go for development)

Source: Internet
Author: User

Python Object-oriented

Python has been an object-oriented language since its inception, which is why it is easy to create a class and object in Python. In this section we will detail Python's object-oriented programming.

If you have not been exposed to object-oriented programming languages before, you may need to first understand some of the basic features of object-oriented languages and form a basic object-oriented concept in your mind, which will help you learn more about Python's object-oriented programming.

Let's start with a brief look at some of the basic features of object-oriented.

Introduction to Object-oriented technology
    • class: used to describe a collection of objects that have the same properties and methods. It defines the properties and methods that are common to each object in the collection. An object is an instance of a class.
    • Class variables: class variables are common throughout the instantiated object. Class variables are defined in the class and outside the body of the function. Class variables are not typically used as instance variables.
    • data members: class variables or instance variables are used to manipulate the data related to the class and its instance objects.
    • method Overrides: if the method inherited from the parent class does not meet the requirements of the subclass, it can be overridden, which is called the override of the method, also known as the override of the method.
    • instance variable: A variable defined in a method that acts only on the class of the current instance.
    • inheritance: A derived class (derived class) that inherits the fields and methods of the base class. Inheritance also allows the object of a derived class to be treated as a base class object. For example, there is a design where an object of type dog is derived from the animal class, which is the analog "is a (is-a)" Relationship (example, dog is a animal).
    • instantiation: Creates an instance of a class, the concrete object of the class.
    • method: a function defined in a class.
    • object: An instance of a data structure defined by a class. The object consists of two data members (class variables and instance variables) and methods.

Let's just write it here! I'm going to eat!

python--Object-oriented (the foundation is all written, the next is the object-oriented, now you can go for development)

Related Article

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.