1. Concepts of classes and objects:
The concept of class abstraction, which represents a class of things that have the same characteristics
The concept of object figurative, individual individual
. Class and object relationships:
-classes are summed up by object abstraction, and the process of summarizing classes by objects is called abstraction
-objects are implemented or implemented by a class, and the process of making an object from a class is called instantiation
For example: Animal is a class, then dog cat Pig. And so on is the instantiation of animals.
A dog is a class, then a pug. All kinds of dogs are examples of dogs.
In the. class, there are 2 contents in a class:
Content used to denote the characteristics of a thing, called a member property (variable)
Content used to denote the function of a thing, called a member method (function)
2. Basic implementation of the class:
Name of the. class file
. Compliance with variable naming conventions
. Using the Hump naming method
. There is one or more words composed
. direct connection between words
. Capitalize each word first letter
. How to declare a class:
. declaring a class with the class keyword
Content in A. Class consists of member properties and member methods, and other content is prohibited from appearing in classes such as Process control, looping statements, etc.
The syntax is correct, but it destroys the structure of the class.
. Define member properties use variable assignment operations, if a member has no value, you need to use None to assign a value (or an empty string?).
Python Classes and objects