home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16623 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.3 KB  |  35 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!ort
  3. From: ort@netcom.com (David Oertel)
  4. Subject: Re: Is Ctor X() required for the object of class X to be able to be dynamically allocated?
  5. Message-ID: <1992Nov20.080626.9582@netcom.com>
  6. Summary: Re: Is Ctor X() required for dynamic allocation
  7. Keywords: constructor X(), dynamic allocation
  8. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  9. References: <BxxC3p.Btn@math.uwaterloo.ca> <1992Nov19.191043.18010@bellahs.com>
  10. Date: Fri, 20 Nov 1992 08:06:26 GMT
  11. Lines: 22
  12.  
  13.  
  14.  
  15. >>In article <BxxC3p.Btn@math.uwaterloo.ca> xjzhu@math.uwaterloo.ca (Xiaojun Zhu) writes:
  16. >>Q: Is it necessary to have a constructor which took no argument in order
  17. >>   for the object of a class to be able to be dynamically allocated?
  18. >>
  19. >>More specifically,  I have a class X, when I can say
  20. >>
  21. >>X *x=new X[10] ?
  22. >>
  23. >>Is it required that class X have a constructor X()?
  24. >>
  25. >I can't cite chapter and verse, but such a constructor is required to
  26. >create arrays of objects.
  27.  
  28.     This is wrong, the compiler should automatically generate the 
  29.     default constructor as well as the copy constructor, the assignment
  30.     operator, and the address-of operators, if you don't explicitly
  31.     specify them.
  32.  
  33.     ort@netcom.com
  34. -- 
  35.