Python Class Inheritance || Vehicle Brand || Single Inheritance || Python
In this we are going to see a basic program to get vehicle name and brand using single inheritance in Python Programming Language.



class Brand():
    def __init__(self,brandName):
        print("Brand Class")
        self.brandName = brandName
    def getBrand(self):
        print("Brand Of Vehicle Is :",self.brandName)

class Vehicle(Brand):
    def __init__(self,brand,name):
        super().__init__(brand)
        print("Vehicle Class")
        self.name = name
    def getName(self):
        print("Vehicle Name Is :",self.name)

v = Vehicle("FORD","GT")
v.getName()
v.getBrand()

# Coded By Dhiraj Shelke


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post