Mar 20, 2013 at 10:13pm UTC
I read this today and thought it was cute:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
class Ball : Throwable {};
class P {
public :
P* Target;
P () {}
P (P* target) {
this ->Target = target;
}
void Aim(Ball ball) {
try {
throw ball;
}
catch (Ball b) {
Target->Aim(b);
}
}
};
int main() {
P Parent;
P Child( &Parent );
Parent.Target = &Child;
Parent.Aim( Ball() );
}
http://xkcd.com/1188/
Last edited on Mar 20, 2013 at 10:20pm UTC
Mar 20, 2013 at 10:23pm UTC
Infinite recursion. Stack overflow.
Mar 20, 2013 at 11:19pm UTC
Xkcd is inconsistent. Sometimes it's excellent, but sometimes it's terrible. SMBC is consistently awesome, I highly recommend it.
Mar 21, 2013 at 1:25am UTC
I like how it passes the ball temp by value so C++11 move constructors are used XD
Mar 21, 2013 at 6:32am UTC
@ Disch
The stack overflow represents the child's bordome with the game of catch and desire to inspect the grass. All of this happens while the parent is trying to throw the ball and ends up pegging the child in the head, thereby knocking it unconscious.