Standard C++ basic examples site

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Standard C++ basic examples site

      Yo all, i've found a very good site for all those C++ beginners who, i'd imagine, often forget some major features of the language at times, how the syntax is supposedly laid out, and how some common classes or templates could be used in an effective manner.

      Documentation is fine- it tells you the syntax but sometimes it doesn't explain everything.

      This site does:
      java2s.com/Tutorial/Cpp/CatalogCpp.htm

      From Hello World to STL Vectors, from Operator Overloading to exception handling, it's got all the examples you'll ever need, in a no-nonsense manner.

      Hope this helps, and probably reduces the time spend flicking through your C++ book for some trivial grammatic rules and things.

      It's also got plenty of Java, Python, C and SQL-related things too, maybe sometime you'll need some of those, that site will be there for you.
      A Toyota's a toyata.
      A dog, a panic in a pagoda!
      God! A red nugget! A fat egg under a dog!
      Go hang a salami, I'm a lasagna hog!
    • This is usually what I use for STL.
      sgi.com/tech/stl/

      It has just enough information to be exactly what I want. Tutorials can bog you down with learning something when often all you want is to remember the function signature or something similar.

      It's also what usually pops up first in google when you search for stl something, which is probably the real reason I use it....

      For C++, I either look it up in C++ Primer or C/C++ Programmer's Bible, or I spin my chair 180 degrees and ask the guy behind me like he does to me every now and then.

      "What's the explicit keyword in front of the constructor mean again? Oh yeah..."

      -Rez
    • Ya i actually got a question for ya guys, I couldn't find it googling- I suppose it's a question of convention, and C++ conventions aren't often written down black on white, so maybe you guys can help me.

      I read mike's source code for the CProcess class, and I notice some virtual methods which accept no parameters to have the declaration...

      virtual bool isDead (void) const {return (m_bKill);};

      and the next one's like

      virtual void Kill();


      Why then, is the keyword "void" put in between those brackets on the first "isDead" method, and not "Kill"?
      Fine if it's convention, but I can't see the consistency there.
      Does i have to do with the fact that an inline implementation is provided, and therefore a void parameter list is explicit?

      Cheers.
      A Toyota's a toyata.
      A dog, a panic in a pagoda!
      God! A red nugget! A fat egg under a dog!
      Go hang a salami, I'm a lasagna hog!
    • It makes no difference. An empty parameter list is the same as putting void there so it's really just a matter of personal preference. A lot of people don't put void there because they don't want to type the extra 4 characters. I do because I think it improves readability.

      -Rez
    • I would imagine it's just an inconsistency in convention. I don't put the "void" the parenthesis simply because I think it's redundant, primarily because it's very visual if there are or aren't parameters being taken by that function.
      Feel you safe and secure in the protection of your pants . . . but one day, one day there shall be a No Pants Day and that shall be the harbinger of your undoing . . .