A step-by-step example that explains how to define a class in a seperate file, and use it in your main file;
--------------------------------------------------------------------------------------------------------------------
- The first class is used as an instance attribute inside the main class.
- Do not forget to import the class that you wanna use as follows:
from file_name(without '.py') import class_name
--------------------------------------------------------------------------------------------------------------------
#python
#objectorientedprogramming
Good Luck !!
Негізгі бет A Simple Example on How to import a custom Class in Your Python Code !!
Пікірлер: 19