First page Back Continue Last page Overview Graphics

Parameter Overloading

The following example shows polymorphism as operator overloading with the „+“-Operator

>>> a = "Spam spam spam"

>>> b = a + "!"

>>> 3 + 4

7

Although we can implement all class behaviour as method functions, it is in many cases more convenient to use operator overloading.

a + b

__add__(self,other)