# HG changeset patch # User Tom Henderson # Date 1249686126 25200 # Node ID 3d08aef4a5815813d79a72645c5d6c1abf78b884 # Parent ba5d6d52be7e1460bb651a34e7ab02fd851ce604 document how to assign attributes in constructor diff -r ba5d6d52be7e -r 3d08aef4a581 doc/manual/attributes.texi --- a/doc/manual/attributes.texi Fri Aug 07 15:34:45 2009 -0700 +++ b/doc/manual/attributes.texi Fri Aug 07 16:02:06 2009 -0700 @@ -489,6 +489,24 @@ @item ATTRIBUTE_HELPER_CPP @end itemize +@subsection Initialization order + +In general, the attribute code to assign values to the underlying +class member variables is executed after an object is constructed. +But what if you need the values assigned before the constructor +body executes, because you need them in the logic of the constructor? +There is a way to do this, used for example in the class +@code{ns3::ConfigStore}: call @code{ObjectBase::ConstructSelf()} +as follows: + +@verbatim +ConfigStore::ConfigStore () +{ + ObjectBase::ConstructSelf (AttributeList ()); + // continue on with constructor. +} +@end verbatim + @node Extending attributes @section Extending attributes