document how to assign attributes in constructor
authorTom Henderson <tomh@tomh.org>
Fri Aug 07 16:02:06 2009 -0700 (6 months ago)
changeset 47003d08aef4a581
parent 4699 ba5d6d52be7e
child 4701 b57d5b1fe68e
document how to assign attributes in constructor
doc/manual/attributes.texi
     1.1 --- a/doc/manual/attributes.texi	Fri Aug 07 15:34:45 2009 -0700
     1.2 +++ b/doc/manual/attributes.texi	Fri Aug 07 16:02:06 2009 -0700
     1.3 @@ -489,6 +489,24 @@
     1.4  @item ATTRIBUTE_HELPER_CPP
     1.5  @end itemize
     1.6  
     1.7 +@subsection Initialization order
     1.8 +
     1.9 +In general, the attribute code to assign values to the underlying
    1.10 +class member variables is executed after an object is constructed.
    1.11 +But what if you need the values assigned before the constructor
    1.12 +body executes, because you need them in the logic of the constructor?
    1.13 +There is a way to do this, used for example in the class 
    1.14 +@code{ns3::ConfigStore}:  call @code{ObjectBase::ConstructSelf()}
    1.15 +as follows:
    1.16 +
    1.17 +@verbatim
    1.18 +ConfigStore::ConfigStore ()
    1.19 +{
    1.20 +  ObjectBase::ConstructSelf (AttributeList ());
    1.21 +  // continue on with constructor.
    1.22 +}
    1.23 +@end verbatim
    1.24 +
    1.25  @node Extending attributes
    1.26  @section Extending attributes
    1.27