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
Post a Comment