Possible Duplicate:
What is this weird colon-member syntax in the constructor?
Hi, I recently came across this syntax in a C++ program. This is not passing parameters to a base class constructor as I know what that looks like and how to code it. This looks like some sort of variable initialization for the class... Here is the code:
class Particle
{
private:
  bool movable;
  float mass;
  Vec3 pos;
  Vec3 old_pos; 
  Vec3 acceleration;
  Vec3 accumulated_normal;
public:
  Particle(Vec3 pos)
  : pos(pos),
    old_pos(pos),
    acceleration(Vec3(0,0,0)),
    mass(1),
    movable(true),
    accumulated_normal(Vec3(0,0,0))
  {}
  Particle() {}
  // More unrelated code
};
 
     
    