-Inheritance allows us to define a class that inherits all the methods and properties from another class.
Parent class-
it is the class being inherited from, also called base class.
Child class-
Child class is the class that inherits from another class, also called derived class.
Syntax-
class parent():
body
class child(parent):
body
program-
#create class
class Computer():
def name(self):
print("Computer class")
class Machine(Computer):
def work(self):
print("Machine class")
c=Machine()
c.name()
c.work()
Computer class
Machine class