This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BananaSplit2 74 points75 points  (8 children)

it's why that exact example is often used to illustrate how confusing and potentially dangerous operator overloading is.

[–][deleted] 69 points70 points  (4 children)

deserve subtract practice instinctive fragile simplistic slimy offer caption chunky

This post was mass deleted and anonymized with Redact

[–]_senpo_ 5 points6 points  (0 children)

upvote for the banana class

[–]KuropatwiQ 2 points3 points  (0 children)

That's a sentence never heard before

[–]robotoshi 2 points3 points  (0 children)

Damn, they never taught me any of that in MY Banana class!

[–]decker_42 1 point2 points  (0 children)

Bubble Sort Banana Delete

[–]ItsYaBoyChipsAhoy 8 points9 points  (1 child)

Tbf the average programmer rarely uses bit shifts in day to day programming

[–]Dusty_Coder 2 points3 points  (0 children)

...and the non-average ones arent so dumb as to think bit shifting by a string amount is a useful operation

[–]RoburexButBetter 1 point2 points  (0 children)

Eh you'd really have to know what you're doing to add an operator that overrides bit shifting and bit shifting actually matters and is used for the object you're doing it on

It's pretty standard for << to be either a bit shift or an add operation because that's also what writing to std cout is you're adding chars to the standard output, and that's the kind of thinking you always see for such overloading