Initializing list

Can I write expression in initializing list, for example,

1
2
3
4
A::A(double diameter):area(diameter*diameter*3.14/4)
{
...
}


here area is a data member of class A.
Yeah. Just don't try to do something like:

1
2
A::A() : diameter(2.5), area(diameter*diameter*3.14/4) //<-- bad, diameter might not be intialized yet
{}
thank you very much!
I just read The C++ Primer 4th Ed, and I now know the order of data members is so important.
Take a look at my article, more importantly Disch's reply: http://www.cplusplus.com/forum/articles/17820/#msg90014

Topic archived. No new replies allowed.