Many of my students have small, niggling issues with C++ syntax -v- Java syntax. I’ve put together a syntax cheat sheet.
c++-crib-sheet, now updated with all the feedback from comments. Thanks a lot.
I’d appreciate it if people could point out errors and omissions.
[...] C++ cheat sheet for students http://blogs.linux.ie/balor/2009/10/04/a-c-cheat-sheet/ Critique [...]
I saw Cian mentioning this site on the minds chat room the other day:
http://www.parashift.com/c++-faq-lite/
It looks good so I bookmarked it for myself.
Your students might find it useful.
C++ Conditional Statements should be
std::endl instead of std::end
I thought the vector iteration didn’t have a header at first pass, since I was reading it as three columns down rather than across. Also I didn’t know that C++ had System.out.println
For the inheritance and interface examples, is it worthwhile putting the constructors in?
Under “Conditional statements” std::end should be std::endl.
Maybe it’s worth mentioning import vs #include, and particularly
Under “Inheritance”, there’s a missing semicolon after ~Widget(). Also, Widget’s destructor should be qualified as virtual (as should Frob’s – and IWidget’s).
In the right column, you’ve slipped a System.Out.println() into the C++ code. Also, it may be that correctly defined iterators will have a suitably overloaded operator-> so the (*i). may rightly be i-> … I don’t recall for sure though.
Also, maybe something on pass by value vs pass by reference.
Shouldn’t the C++ vector iterator be declared as “vector::iterator”?
Doh! My comment was processed as html…. I typed vector\::iterator
Doh… vector open angle bracket Widget close angle bracket ::iterator. Sorry for messing up your blog page!
The link to the file is invalid. It just downloads a zero byte file. Can you please re-upload it? Thanks.