[18 / 0 / ?]
Quoted By:
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
which will allow statements like
which modify the degree without having to use =!
But the fun doesn't stop there. Since ~ is useless anyway, something like
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.
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.