Rss Feed
  1. Operator Overloading

    Monday, June 23, 2014

    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.

  2. 0 comments:

    Post a Comment