TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CLIFF RHODES
from: FRANK ADAM
date: 1997-08-19 06:45:00
subject: ctors

On Aug 16 11:14, 1997, Cliff Rhodes of 1:106/2000 wrote:
G'day Cliff,
BL>>Is this to much.. 
BL>>manifest::manifest(){
BL>>     filename = new char[FILENAME_MAX];
BL>>     while (!select(filename, FILENAME_MAX - 1));
BL>>     mstreamp = new ifstream(filename);
BL>>}
Sometimes i want to initialize a number of variables in the constructor, in 
that case i normally have a public variable( call it initsuccess). This way 
the class can refuse all consequent calls with a single if() if the init 
failed on any item.
Don't know how artistic that aproach is, but it works fine for me. :-)
 
CR> Not necessarily although it does pose some problems with error 
CR> handling (which you could do with exceptions). Your options are to 
I've been thinking about this for a while, is there a technical reason
why constructors are not able to return a value ?
 Regards, Frank
--- Msged 4.00
---------------
* Origin: The ticking point, Melbourne, Australia. (3:635/728.21)

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™.