Python - Polymorphism and Dynamic Behavior
Given these classes:
What does this example illustrate about polymorphism?
class Printer:
def print(self):
return "Printing document"
class Scanner:
def print(self):
return "Scanning document"
devices = [Printer(), Scanner()]
for device in devices:
print(device.print())What does this example illustrate about polymorphism?
