Driver Programming: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
{{syntaxhighlight|lang=python|code= | {{syntaxhighlight|lang=python|code= | ||
from EmptyDeviceClass import EmptyDevice # Loading the EmptyDevice Class | from EmptyDeviceClass import EmptyDevice # Loading the EmptyDevice Class | ||
class Device(EmptyDevice): # Creating a new Device Class by inheriting from EmptyDevice | |||
def __init__(self): # The python class object need to be initialized | |||
EmptyDevice.__init__(self) # Finally, the initialization of EmptyDevice has to be done | |||
}} | }} | ||
This is a minimal working example to create a Device Class. | This is a minimal working example to create a Device Class. |
Revision as of 22:48, 30 November 2017
A Device Class is a main.py file in which a python class-Object is inherited from a parent class called EmptyDeviceClass.
from EmptyDeviceClass import EmptyDevice # Loading the EmptyDevice Class
class Device(EmptyDevice): # Creating a new Device Class by inheriting from EmptyDevice
def __init__(self): # The python class object need to be initialized
EmptyDevice.__init__(self) # Finally, the initialization of EmptyDevice has to be done
This is a minimal working example to create a Device Class.