+ 1
What is the purpose of magic methods whether I can do the same work by using regular codes?
3 Answers
+ 1
Magic methods can be accessed by operators such as +
Instead of needing to call the method:
obj1.add(obj2)
You can simply:
obj1 = obj1 + obj2
+ 1
It is easier to read and understand and is less verbose and doesn't populate as much the class methods.
0
I understand that.But why I need to do so as I can easily perform the same work by using structured programming?