Python Class Inheritance || Vegetable Name || Single Inheritance || Python
In this we are going to see a basic program to get vegetable name using single inheritance in Python Programming Language.



class Name():
    def __init__(self,name):
        print("Name Class")
        self.name = name
    def getName(self):
        print("Vegetable Name Is :",self.name)

class Vegetable(Name):
    def __init__(self,name):
        super().__init__(name)
        print("Vegetable Class")
    
v = Vegetable("Carrot")
v.getName()

# 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