0
Magic Methods Help
I need some help understanding magic methods. I understand most of it but im not seeing how a few things work like how can other have other.x and other.y...also how is it adding both bottom values https://code.sololearn.com/cGmPHDcEi9ZG/?ref=app https://code.sololearn.com/cGmPHDcEi9ZG/?ref=app
5 Antworten
0
The __add__ method is called by the + operator, and is passed “second” as an argument. Thus, thr vector assigned to “second” appears as the parameter “other” in the __add__ code.
0
yeah im still super confused 😕
0
Well...
Maybe you should back up. This is very simple unless one didn’t learn OOP, in which case it could be very difficult.
0
Ill try to explain with code...
0
Here. Take a look at this code, then see the result.
https://code.sololearn.com/co7aOas1U9jl/?ref=app