Update 2024-03-27: Greatly expanded the "Samples" page and renamed it to "Glossary".
Update 2024-04-04: Added 5 million mid-2011 posts from the k47 post dump. Browse (mostly) them here.
Update 2024-04-07: Added ~400 October 2003 posts from 4chan.net. Browse them here.

Welcome to Oldfriend Archive, the official 4chan archive of the NSA. Hosting ~170M text-only 2003-2014 4chan posts (mostly 2006-2008).
[18 / 0 / ?]

[1395957794] Operator overloading is the greatest ever!!

No.958520 View ViewReplyOriginalReport
I discovered operator overloading in Sepples today and I must say that this is the most powerful language feature I've ever seen. Just thinking about the possibilities makes precum pool on the tip of my cock! Let me give you an example of the power. Since I like spinning things, suppose so make a class that models an angle. With stupid people languages you'd use accessors, but by overloading operators anything is possible.

Personally, I hate the = operator, so I can just do something like
Angle* Angle::operator+(double operand){this->degrees += operand; return this}
which will allow statements like
theta + 12.5;
which modify the degree without having to use =!

But the fun doesn't stop there. Since ~ is useless anyway, something like
double Angle::operator~(){return this->degrees;}
can be used as an accessor.

This is obviously a trivial example, but literally every problem can be treated this way. Tomorrow at work, I'm going to begin refactoring the entire code base to take advantage of this feature. I hope my teammates appreciate the conciseness of the new design.