# Classes and methods
Class Count ():
def __init__ (self, AAA, BBB): # Initialization
# Public parameters can be put in
Print ("Init content is executed when instantiated")
SELF.A = AAA
self.b = BBB
# Add Self is a global variable, no self is a local variable
def ABB (self): # method called inside the # class, not called function
return SELF.A + self.b
def ABB (self, A, b): # method inside the # class, not called function
Return SELF.A * self.b
def aee (self, A, b):
# Self is the object itself, instance parameters of the class itself
Self.abb () # Internal call when directly self. method
If __name__== ' __main__ ': # The following code runs only in the current script
Count = count () # The class is instantiated as an object, there are no arguments at this time, and the methods inside the class can be invoked after instantiation
Count.add (1, 3) # Call the Add method of the A object
b = Count (10, 5)
AA = B.abb ()
Print (AA)
Python interface Automation Test 21: Classes and methods