initializing constructor?

Oct 20, 2011 at 8:49pm
HI! i had a question about constructors.
Which is the best way to initializing your construcotor?:

this way?
MyClass::MyClass(int a, int b):iMyAge(a), iMySalary(b)
{
}

Or this way?
MyClass::MyClass(int a, int b)
{

iMyAge = a;
iMySalary = b;
}

-Is there any difference between this too?
-When should i use the first one and when should i use the second?
Oct 20, 2011 at 8:56pm
Oct 20, 2011 at 9:02pm
Thanks EricDu! ;)
Topic archived. No new replies allowed.