I'm having trouble finding anything on google that tells me what this is. What is the purpose of this syntax? Are these optional paramaters that are being given default values?

04-26-2011

Elysia

It is called a initializer list. Basically, it initializes member variables with a given value.
(This is different from assigning since assigning calls the assignment operator and initialization will call a constructor.)

04-26-2011

jimblumberg

This like a incorrect attempt of using initialization list. The reason it is incorrect is that initialization lists only work with constructors not member functions.

Code:

void myclass::myclass(): a(0), b("hello")
{
}

Would be correct if your class had a variable named a and a string variable named b.
See this link on initialization lists.