7
useVim
3y

what!

I didn't know you could overload an operator.

Comments
  • 9
    A whole new world just opened for you!!!

    Mainly the world of frustration when languages like Java don't allow it!
  • 0
    Why tf one would overload an operator. Let this shit operate in peace.
  • 4
    @devapsarl
    Best example case for custom classes, say a Matrix class can overload Operators so you can do Matrix multiplications like
    m3 = m2 * m1;
    Instead of
    m3 = m2.multiply(m1);
  • 1
    @Hazarth ah, that sounds about right. For a minute I also thought: "WTF". Minute later: "That's a time saver!"
    No wonder that Python is adored among STEM specialists. It's just one of those things that'd prove decisive in choice of language sometimes.
  • 1
    @Hazarth yes but let’s be real: vectors are the prime example for operator overloading 😄
  • 0
    @Hazarth aaaaaah
    It's when a class implement iComparable so u can use a<b
Add Comment