Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to inherit a class in python

class Bird():
        def eat(self):
                print ("eating")
 
class Sparrow(Bird):
        def sound(self):
                print ("ChiChi!")
 
birdobj = Sparrow()
birdobj.eat()
birdobj.sound()
 
PREVIOUS NEXT
Tagged: #inherit #class #python
ADD COMMENT
Topic
Name
6+1 =