   reading C++
  Hey how do you read this?:FPSDemo::FPSDemo():mRotation(0), mRunning(true), mGlow(0), mWidth(800), mHeight(600), mTime(-1), mDeltaTime(0), mInit(true), mResolutionChange(false), mHaveFullscreen(false){//blah blah blah}I don't get that colon followed by function calls.  What is that?  Does it have something to do with inheritance?Hey and those aren't even functions, they're variables.  Or at least mHaveFullscreen is a variable.   
  Do a search for 'c++ initializer list'.   ;  Okay.   ;  The : marks the beginning of the member initialization list. Each of the following elements are the name of a member variable. The values inside the parenthesises are values passed to the constructor for each member variable. So it constructs mRotation with the argument 0, mRunning with the argument true, and so on. In this case it doesn't look like there are any base classes, but base classes can also be initialized in the member initialization list.   ;  Okay I think I understand it now.  But for primitive types what is the point?Like suppose mRotation was a class, then saying :mRotation(0) would be saying use the constructor in mRotation that takes one int as a parameter, right?  But mRotation is an int.  Why not just say mRotation=0 in the brackets?  (where I say "blah blah blah")   ;  For primitive types, it will probably generate the same code either way. However, it's never worse to use the member initialization list than to assign inside the braces. The opposite isn't true, so using the member initialization list is a good habit to have.   ;  Reference types and const types also need to be initialized in initializer lists, rather than the body of the constructor. Those are uncommon-ish in classes, but sooner or later you'll need one.   ;  It's called an initialiser list, it's the same as if you did this..FPSDemo::FPSDemo(){    mRotation = 0;    mRunning = true;    mGlow = 0;    mWidth = 800;    mHeight = 600;   etc...}So it's a way of initialising member variables in your class. For primitive types (just read your last post) it's just a matter of style - as far as im aware - so either way is fine. But if you have a base class with no default constructor ie. it needs some params, you must initialise it using the initaliser list..FPSDemo::FPSDemo( int width, int height ) : BaseClass( width, height ){    mRotation = 0;    mRunning = true;    etc..};Quote:Original post by supamikeIt's called an initialiser list, it's the same as if you did this..*** Source Snippet Removed ***So it's a way of initialising member variables in your class. For primitive types (just read your last post) it's just a matter of style - as far as im aware - so either way is fine. But if you have a base class with no default constructor ie. it needs some params, you must initialise it using the initaliser list..*** Source Snippet Removed ***The difference is that the first is initialisation, the later is assignment. Indeed it often makes no difference for primitive types which are not references.To give an example where performance may suffer:class X {public:    X() : value(0) {}    X(int i) : value(i) {}    X & operator = (int i) { value = i; }private:    int value;};Now in your application code:class Y {private:    X x;public:    // Version 0    Y () : x(42) {}    // Version 1    Y () { x = 42; }};In version 0, everything is fine and you won't suffer. But in version 1, because you didn't initialize Y::x explicitly, the default constructor of x (X::X(){...}) will be called, and after that, the copy-assignment operator of x (X::operator =(){...}) will be called."Program-Flow" of Version 0  Y::Y()  -> X::X(int)"Program-Flow" of Version 1  Y::Y()  -> X::X()  -> X::operator =(int);  What they said, but also consider what happens in the presence of exceptions.  Consider binders and functors.  Consider templates.Here's a good rule of thumb for idiomatic C++:  always initialize your variables at the point of instantiation.  The corollary of this rule is that you should delay instatiating objects until you have enough information with which they can be initialized.   