You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
394 B
22 lines
394 B
4 years ago
|
class Instrument:
|
||
|
def makeSound(self):
|
||
|
print("Nothing happens")
|
||
|
|
||
|
class Guitar(Instrument):
|
||
|
def makeSound(self):
|
||
|
print("Epic guitar sound!!")
|
||
|
|
||
|
class Piano(Instrument):
|
||
|
def makeSound(self):
|
||
|
print("Wonderful piano sound!!")
|
||
|
|
||
|
def startConcert(inst):
|
||
|
inst.makeSound()
|
||
|
|
||
|
i = Instrument()
|
||
|
g = Guitar()
|
||
|
p = Piano()
|
||
|
|
||
|
startConcert(i)
|
||
|
startConcert(g)
|
||
|
startConcert(p)
|