C++ constructor format -


possible duplicate:
what weird colon-member syntax in constructor?

hi,

in sams teach c++ in 21 days book, day 12: implementing inheritance, code snippet:

mammal(): itsage(2) , itsweight(5) {}

is equivalent saying?

mammal()  {  itsage(2);  itsweight(5);  } 

what advantage first form have? usage in book?

thanks.

the first initialization list syntax, not function calls second snippet. http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.6


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -