[comp.lang.c++] Flagging errors while executing a Constructor.

positron@cosmic.berkeley.edu (Shigeki Misawa) (06/04/91)

	Hi! Sorry if this is a FAQ, but I was wondering what the
standard practices are in detecting errors while executing a C++
constructor, since the constructor is required to have no return
value. For example, if a particular class allocates a large amount
of memory from free store and there is insufficient memory
available, how do you detect that this has occurred from  outside
the class. The only thing that I can think of is having a 
"success" flag and a member function that returns the value of the
success flag.

	Also, from a style viewpoint, if a class is created to act
as a gateway to a file with information, should the information be
transfered from the file through the constructor or with an
initialization member function?

Sorry if these questions seem stupid or lack the appropriate 
"OOP" philosophy, but this is my first major C++ project after
having made several passes over Lippman's book , Boochs' book and
Stroustrup's book. Thanks in advance.


Shigeki Misawa UCB Physics Department