home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13381 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.1 KB  |  58 lines

  1. Path: sparky!uunet!mcsun!uknet!mucs!lucs!scsr91
  2. From: scsr91@csc.liv.ac.uk (Mr. J.A. Coyne)
  3. Newsgroups: comp.lang.c++
  4. Subject: Creating arrays of a class object using default constructor
  5. Message-ID: <Bu7L6G.7C8@csc.liv.ac.uk>
  6. Date: 7 Sep 92 12:54:15 GMT
  7. Sender: news@csc.liv.ac.uk (News Eater)
  8. Organization: Computer Science, Liverpool University
  9. Lines: 46
  10. Nntp-Posting-Host: irw.csc.liv.ac.uk
  11.  
  12. Using the HP version of AT&T release 2.1 compiler
  13.  
  14. If I have the following classes
  15.  
  16. class compound  {
  17.  
  18.    basic * array; // pointer to class basic
  19.  
  20. public:
  21.  
  22.    compound(); // class constructor function
  23.  
  24. };
  25.  
  26. //*************************************************
  27. compound::compound()  {
  28.  
  29.          array = new basic[10];
  30.  
  31. }
  32.  
  33. //*************************************************          
  34.  
  35. which calls up the constructor for the class basic
  36.  
  37.  
  38. class basic {
  39.  
  40.     int * vector;
  41.  
  42. public:
  43.  
  44.       basic(int =5) ;
  45.  
  46. };
  47.  
  48. //************************************************
  49.  
  50. basic::basic(int size)  {
  51.  
  52.    vector = new int[size];
  53.  
  54. }
  55.  
  56. The error message I recieve is  : default arguments for constructor for array
  57. of class basic(2005)
  58.