#20 Inheritance In Python

Опубликовано: 03 Май 2026
на канале: Shaileshkumar Singh
127
14

This video will tell you about Inheritance in Python with example in detail

Below is the python code:

class Person:
def displayName(self):
print("displaying name")

def displayGender(self):
print("displaying gender")

def displayAddress(self):
print("displaying address")

class Student(Person):
def attendingClass(self):
print("attending class")

class Teacher(Person):
def takingClass(self):
print("taking class")

student=Student()
student.displayName()
student.displayGender()
student.displayAddress()
student.attendingClass()

teacher=Teacher()
teacher.displayName()
teacher.displayGender()
teacher.displayAddress()
teacher.takingClass()




Music: https://www.bensound.com