|
|
|
|
|
by reichstein
6 days ago
|
|
So the `+` is not _overloaded_, the `+` syntax is a shorthand for calling a method named `__add__` on the value of the first operand, with the value of the second operand as an argument . That is: `e1 + e2` is syntactic sugar for `e1.__add__(e2)`, no more and no less. It's not "operator overloading" any more than two _different_ classes having a `length` property is "length overloading". Using the term "operator overloading" to begin with is the error here. |
|
The article is showing function overriding, not overloading, which is just standard class inheritance stuff.