0

What is the main reason for using magic methods?

I understand how the code compiles step by step but I am not getting why we need to use magic methods and operator overloading. Can anyone please help me with clear explanation of this?

25th Oct 2016, 7:40 PM
Misty Moon
Misty Moon - avatar
1 Resposta
+ 4
They allow for synthax simplifications. They can turn obj1.add(obj2) into obj1 + obj2 for example.
25th Oct 2016, 10:48 PM
Zen
Zen - avatar