One of my favourite feature of C++ has been now made available to iOS / Mac Developers in swift! Now you can overload any operator or combination of operators and thus be able to define a behaviour to implement when its used in an expression.
Below is a piece of code that you can try out in Xcode's Playground
With the addition of === operator, using == operator for comparing 2 reference type results in a compiler error, unless you overload it as shown above.
Below is a piece of code that you can try out in Xcode's Playground
0 comments:
Post a Comment