Let's Code Like it's Nineteen Ninety Five!
Language butchery by Mr Rich on 15.3.10 @ 00:16
So I've taken two quarters of C++ now and I realize that I haven't made much use of C++. Oh sure -- I've used class and new/delete, but that's about the extent of it. Oh yeah -- I can declare a variable wherever I want (ooo!) But, one eventually realizes (although it was pointed out to me) that the difference between a struct and a class is semantical.
Function ponters: Here's my favorite quote about their use in classes:
Oh well... on to Finals.
- The default protection for a struct is public;
- the default protection for a class is private;
- both can have public and private members.
- If you want to teach programming using C -- great! ...Use C.
- If you want to teach programming using C++ -- great! ...Use C++.
- But for fsck's sake: if you are going to teach C++ like it's C -- please.... at least teach us how to use malloc(), realloc(), and free()!
Function ponters: Here's my favorite quote about their use in classes:
"..The operator ::* is used to point to a member of a class. ..... The syntax for ponters to member is a little convoluted and not terribly useful. Ive only seen it once used by an *extremely clever* programmer [ed: not a compliment from this author]. ... and the first maintenance programmer who got the code immediately ripped it out"... Do we need to understand how to use them? Maybe. One other person put it in terms of "this is actually a good use for a macro..." But using them to point to static functions to a class? Where is the gain? Why not just declare a function w/o a function pointer? Isn't it better to be fscking explicit than to be clever?
- Steve Oualline, Practical C++ Programming, 2nd ed.
Oh well... on to Finals.