How to Use a Class¶
Before learning how to make our own class, we need to learn how to use it.
Instantiate a class¶
Don’t worry about the code, only focus on the last line, which creates an instance from the class and assign the instance to the variable me
.
Get/Set Attributes of a Class¶
Use instanceName.attributeName
to get or set the value of an attribute.
Use Method¶
Use instanceName.methodName
to invoke method in the instance.
Last update:
March 24, 2021
Created: March 24, 2021
Created: March 24, 2021