First of all, for people who want to vote this down, note that the member variables were not shown in the class reference and the link to the header file was broken!
I have the following constructor:
Foam::IOobject::IOobject
143 (
144 const word& name,
145 const fileName& instance,
146 const objectRegistry& registry,
147 readOption ro,
148 writeOption wo,
149 bool registerObject
150 )
151 :
152 name_(name),
153 headerClassName_(typeName),
154 note_(),
155 instance_(instance),
156 local_(),
157 db_(registry),
158 rOpt_(ro),
159 wOpt_(wo),
160 registerObject_(registerObject),
161 objState_(GOOD)
162 {
163 if (objectRegistry::debug)
164 {
165 Info<< "Constructing IOobject called " << name_
166 << " of type " << headerClassName_
167 << endl;
168 }
169 }
As far as I have read initializer are used to:
See: https://stackoverflow.com/questions/2445330/importance-of-a-singlecolon-in-c
I just can't figure out what the elements in the examples constructors initializer are for since they are no member variables of the class IOobject
and aren't constructors of derived classes. Can someone tell me what these initializer elements are for?
greetings streight
From your link, if you navigate to the header file, it shows the members, so it is clear that there is no base class and the initialiser list in the constructor initialises members alone.
127 //- Name
128 word name_;
129
130 //- Class name read from header
131 word headerClassName_;
132
133 //- Optional note
134 string note_;
135
136 //- Instance path component
137 fileName instance_;
138
139 //- Local path component
140 fileName local_;
141
142 //- objectRegistry reference
143 const objectRegistry& db_;
144
145 //- Read option
146 readOption rOpt_;
147
148 //- Write option
149 writeOption wOpt_;
150
151 //- Register object created from this IOobject with registry if true
152 bool registerObject_;
153
154 //- IOobject state
155 objectState objState_;