document how to assign attributes in constructor
authorTom Henderson <tomh@tomh.org>
Fri, 07 Aug 2009 16:02:06 -0700
changeset 4700 3d08aef4a581
parent 4699 ba5d6d52be7e
child 4701 b57d5b1fe68e
document how to assign attributes in constructor
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