In Python, a class in two steps:
-
It should first be instantiated class;
-
Then the application class. Note that the example of the process should be bracketed.
# - * - Coding: UTF-. 8 - * - '' 'in Python, should first instantiate a class, then the application class. Note that the example of the process should be bracketed. '' ' Class the TestClass: DEF the __init __ (Self): Print (' the In the init ') DEF testFunc (Self): Print (' the In testFunc ') ' '' ERROR1: # wrong way: uninitialized print (TestClass.testFunc ( )) TypeError: testFunc (). 1 Missing required Positional argument: 'Self' ERROR2: # wrong way, TestClass: No parentheses testInstance the TestClass = Print (testInstance.testFunc ()) TypeError: testFunc (). 1 Missing required Positional argument: ' Self ' ' '' # the right way, TestClass (): In test testFunc None