Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
shivangiS04 authored Oct 5, 2023
1 parent 1e1ad4e commit a4a26e1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Python/single inheritance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class animal: #superclass
def speak(self): #method/function in superclass
print("animal speaking")

#child class dog inherits from superclass animal
class dog(animal): #child class
def bark(self):
print("dog barking")

d=dog() #object of child class
d.bark()
d.speak()

0 comments on commit a4a26e1

Please sign in to comment.