Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the classes and objects in python

Shulou Source: shulou.com Published: 2022-06-02 06:23:50 09月30日 Update

This article focuses on "what are the classes and objects in python". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the classes and objects in python?"

One, POP and OOP

What is object-oriented programming?

POP: Process Oriented Programming. The program is seen as the sequential execution of a series of commands. The basic encapsulation form is function. The basic point of designing a function is IPO: input Input-- > handle Process-- > output Output.

OOP: Object Oriented Programming. The program is seen as the interaction of a series of objects. The basic form of encapsulation is class. The basic points of designing a class are RPM: relational Relation, attribute Property, and method Method.

2. Basic object-oriented concepts?

Classes: class, abstract data structures, data and algorithm encapsulation. For example, define a class: dog.

Object: object, an instance of the class. For example: an instance of the dog class: dot dot.

Attribute: properties, the data part associated with the object. Such as: weight weight, breed variety.

Method: methods, the algorithm part associated with the object. Such as: run (), eat (), bark ().

3. what are the advantages of object-oriented programming?

Easy to use: encapsulation, wonderful period symbols.

Easy to extend: inheritance, polymorphism.

Second, create classes and objects

Third, obtain object information

At this point, I believe you have a deeper understanding of "what are the classes and objects in python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Object encapsulation data method content function instance property form program algorithm main point part association learning programming design polymorphism utility deeper Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Shulou Tech Info Huawei Linux