In this we are going to see a basic program on hybrid inheritance with 3 classes in Python Programming Language.
class transport:
def trans(self):
print("Reach a destination far away")
class Walk(transport):
def walk(self):
print("Location can walked to")
class Water_Vehicle(transport):
def Winfo(self):
print('Traverses on water')
class Road_Vehicle(transport):
def Rinfo(self):
print('Traverses on road')
class Vehicle(Road_Vehicle,Water_Vehicle,Walk):
def info(self):
print("But if not walk, can use a vehicle which can be a road or water vehicle")
veh = Vehicle()
veh.trans()
veh.walk()
veh.info()
veh.Winfo()
veh.Rinfo()
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP