B
Brian Folke Seaberg
I have been examining the documentation for a class library written in C++.
It seems that most of the classes in that library use two stage initialization.
Objects are not ready for use after construction. Objects are ready for use
only after post-constructor initialization functions have been executed.
I prefer one stage initialization. I believe that upon completion of object
creation an object should be in a valid state and therefore immediately usable.
Are there practical reasons to split initialization into two steps?
What does one gain by doing so?
===============
Brian Folke Seaberg
===============
"A noble spirit embiggens the smallest man" -- Jebediah Springfield
It seems that most of the classes in that library use two stage initialization.
Objects are not ready for use after construction. Objects are ready for use
only after post-constructor initialization functions have been executed.
I prefer one stage initialization. I believe that upon completion of object
creation an object should be in a valid state and therefore immediately usable.
Are there practical reasons to split initialization into two steps?
What does one gain by doing so?
===============
Brian Folke Seaberg
===============
"A noble spirit embiggens the smallest man" -- Jebediah Springfield