TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BENJAMIN L MCGEE
from: CAMERON CLARK
date: 1997-08-16 03:00:00
subject: Re: replies here -[]

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.