Bryan <> wrote in news:06aph.43401$wc5.41974
@newssvr25.news.prodigy.net:
> Hi,
>
> Where is the proper place to use a member initialization list, the
> header or cpp file?
Wherever you're defining your constructor.
> Does it make any difference?
Yes, probably. But that's only because member bodies which are defined
directly within the definition of a class are implicitly marked as
inlined functions (reminder: inline is only a hint to the compiler, the
compiler is not required to respect the hint).
> Also, is there any difference between using a member initialization
list
> and initializaing member variables in the constructor?
>
> i.e.
>
> MyClass(void) : a(1), b(2) {};
>
> vs
>
> MyClass::MyClass(void)
> {
> a = 1;
> b = 2;
> }
Yes. See the FAQ, section 10.6 (
http://www.parashift.com/c++-faq-
lite/ctors.html#faq-10.6)