G'day all,
Just a bit of background. I have been programming in Qbasic for about 12 yrs, and then through uni (about 8 yrs ago) did a semester of introductions to C (although had also self-taught some C anyway), then spent most of it in Java.
My Java skills are pretty good - to me the language seems far more elegant than C++. I realise it comes at a price, but the errors I get in Java are childs play compared to the mess I can make of a C++ program :S
Anyway, while I was learning Java I was also teaching myself some C++. However, my C++ has always been at the level of "learn it as I need it", and tends to be "I know I can do something in Java, so I should be able to do it in C++". I think this leads to problems, especially where Java does some things differently to C++ (eg garbage collection / dynamic memory, passing parameters to functions). I think I'm missing a lot of the syntax / underlying knowledge of C++ - and instead learning it as if it is the bastard son of C and Java, and learning it in an ad-hoc way.
What would be a good way of filling in these gaps? I'm pretty sure beginner level stuff is well beneath me - the sort that will spend the first 3 chapters writing "Hello World" then going into if statements. The following is a list of my weaknesses:
- Objects - syntax, passing them around, using them, inheritance etc. Again, I know conceptually how they work, they just don't seem to work with me behind the keyboard.
- STL libraries - starting to get into these, but again ad-hoc and it seems to take me hours to do the simplest things.
- Memory management - again I know enough to know I don't really get this completely.
Heh, even this list is starting to sound like "stuff I do in Java but not in C" :P
I'm sure there's more, but any advice on a rigorous way to learn this stuff? It's getting frustrating spending hours doing simple things, then many hours more fixing them to do it right. I'm not sure searching for ad-hoc internet tutorials / examples is the most efficient way to keep doing it.
*Disclaimer: I did not say Java is better than C++. I do however find it a lot more elegant to read / write - no stuffing around with pointers, memory management etc - it all just works. I know this comes at a tradeoff, C++ giving you lower level access and higher speed. Just trying to avert an accidental flamewar :P