Wednesday, January 26, 2011

Sneaky, Ninja C++

Last night I did a few more problems out of How Not To Program in C++ and really liked the last one I did before I went to bed. Apparently in C++, when you have a base class and a derived class, defining a function in the derived class sets *ALL* the functions of the same name to hidden in the base class, no matter what datatypes said function takes as an argument. I loved this problem, it was such a sneaky specification! Every time I do a problem out of this book I'm delighted by all the obscure little compiler rules and datatype issues the deceptively simple programs illustrate. Just out of curiosity, I whipped up a similar program in Java, and it seems to have a similar problem; in fact, the compiler gave me an identical error, which was amusing.

Anyway, besides amusing myself with trivial C++ exercises, I've started reading In the Miso Soup by Ryu Murakami for the second (or maybe third?) time. I was interested in reading it in college, but a friend of mine had divuldged what I felt to be the entire plot, so I was frustrated enough to avoid it until recently, when I decided it was ridiculous to not read a 200-page, well regarded book just because I knew part of the plot. I mean, if that were the case, why bother reading any of the classics I enjoyed so deeply? Who doesn't know the plot of The Odyssey already? So I picked it up from the library, and so far I really enjoy it, though I feel at times the translation may not be amazing...some of the writing just feels forced or stilted. Maybe it was intentional though, I'll have to read more on the author.

Signing off for now.

1 comment:

Konstantin said...

Hi! "How Not To Program in C++" Who's author?