home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!ort
- From: ort@netcom.com (David Oertel)
- Subject: Re: Is Ctor X() required for the object of class X to be able to be dynamically allocated?
- Message-ID: <1992Nov20.080626.9582@netcom.com>
- Summary: Re: Is Ctor X() required for dynamic allocation
- Keywords: constructor X(), dynamic allocation
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- References: <BxxC3p.Btn@math.uwaterloo.ca> <1992Nov19.191043.18010@bellahs.com>
- Date: Fri, 20 Nov 1992 08:06:26 GMT
- Lines: 22
-
-
-
- >>In article <BxxC3p.Btn@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:
- >>Q: Is it necessary to have a constructor which took no argument in order
- >> for the object of a class to be able to be dynamically allocated?
- >>
- >>More specifically, I have a class X, when I can say
- >>
- >>X *x=new X[10] ?
- >>
- >>Is it required that class X have a constructor X()?
- >>
- >I can't cite chapter and verse, but such a constructor is required to
- >create arrays of objects.
-
- This is wrong, the compiler should automatically generate the
- default constructor as well as the copy constructor, the assignment
- operator, and the address-of operators, if you don't explicitly
- specify them.
-
- ort@netcom.com
- --
-