class Penguin: public Bird {
public:
virtual void fly() { error("Attempt to make a penguin fly!"); }
};
This struck me a remarkably funny, particularly if you include exception handling:
virtual void fly() { throw new PenguinError("Attempt to make a penguin fly!"); }
Q: How do you attempt to make a penguin fly?
A: You throw it.
Q: Well how does that work out for ya?
A: The penguin seems to be 'in flight' for a bit and then crashes.
Right now I'm really regretting that I can't use exceptions at work because I can't wait to derive a Penguin class from Exception just for that case!
No comments:
Post a Comment