home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc6.cs.uiuc.edu!pjl
- From: pjl@sparc6.cs.uiuc.edu (Paul Lucas)
- Subject: Re: Return value for the constructors.
- Message-ID: <1992Aug19.011903.20901@sunb10.cs.uiuc.edu>
- Sender: news@sunb10.cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <3462@unisql.UUCP> <1992Aug18.210209.15023@watson.ibm.com> <3468@unisql.UUCP>
- Distribution: usa
- Date: Wed, 19 Aug 1992 01:19:03 GMT
- Lines: 26
-
- In <3468@unisql.UUCP> nandraj@unisql.UUCP (Nandraj Arni) writes:
-
- >> In article <3462@unisql.UUCP>, nandraj@unisql.UUCP (Nandraj Arni) writes
- >> :
- >> >
- >> > Why does C++ not let you have a return value for a constructor?
- >> > Is there any rationale behind this?
- >>
- >> Before we answer that question, we should ask what do you want it for?
- >> A language can't provide every conceivable feature; unless a feature is a
- >> significant improvement to the language, it is an unnecessary complicati
- >> on.
-
- > The reason I think it is a important feature the constructor should
- >return whether it was a success or not? Say I want there is a time
- >class which takes in put as MM/DD/YY. If the values were out of range
- >for an instance of this class, the user should know that it was a bad
- >way to construct this class. OR say it could not allocate memory...
-
- *****> You should have said that originally. *THAT* purpose is one of
- the things that the forthcoming excpetion-handling feature will
- address.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-