Class: A collection of objects that describe an object with the same properties and methods, which defines the properties and methods that are common to each object in the collection. An object is an instance of a class.
Object: an instance of a data structure defined by a class. Object consists of two data members (class variables and instance variables) and methods
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
Instance variable: A variable defined in a method that only acts on the class of the current instance.
Use of "classes" and "objects":
A class is a template that can contain multiple functions and functions in a template.
Objects are instances created from templates that can execute functions in a class through an instance object
# Create a class class Foo: # function in class def Bar (self): # function Description pass # --------finished-------- # Create object from fooobj = foo ()# When creating an object, remember to add a parenthesis
Note that the class is represented as a hump (HelloWorld) According to the Python general rules
And the other obj, and so on, are separated by ' _ ' (this_is_object)
function in a class The first argument must be self, and the function defined in the class is called the "method"
The 4th Lesson of "Julyedu-python Foundation": Object-oriented Foundation