Python class
provides it Object Oriented Programming (OOP) capabilities.
Python class
supports inheritance.
class human: name = 'unknown'def speak(self, word):#use self as the 1st argument
>>> Jack = human() >>> Jack.name = "Jackson Martin" >>> Jack.speak("I am Jackson Martin")
I am Jackson MartinInherit class employee from class human:
class employee(human): department = 'unknown'def showdepartment(self):
>>> Jack = employee() >>> Jack.name = "Jackson Martin" >>> Jack.department = "IT" >>> Jack.showdepartment()
IT