BL> I'd like the opinion of the folks in this echo concerning the
BL> following statement from the book "Black Belt C++..."
BL>
BL> ``
BL> C programmers are faced with two temptations in writing
BL> constructors:
BL> manifest::manifest(){
BL> filename = new char[FILENAME_MAX];
BL> while (!select(filename, FILENAME_MAX - 1));
BL> mstreamp = new ifstream(filename);
BL> }
BL> How would you define "ascribing to much responsibility to the
BL> constructor?" Is this to much...
My basic rule of thum is to just set up an initial state
for the object. This usually just involves initializing
all variables using in the class.
I do agree that too much code can lead to many exiting states;
however, opening I open files in the constructor and close them
in the constructor (as well as deleting the new'ed streams).
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)
|