home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18537 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.4 KB  |  46 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!math.fu-berlin.de!news.belwue.de!sun1.ruf.uni-freiburg.de!ise.fhg.de!usenet
  3. From: max@ise.fhg.de (Max Kubierschky)
  4. Subject: Re: Newing a pointer to a pointer
  5. Message-ID: <max.725726173@ise.fhg.de>
  6. Sender: usenet@ise.fhg.de
  7. Organization: FhG-ISE - Institute for Solar Energy Systems
  8. References: <1992Dec29.174843.20250@ncsu.edu>
  9. Date: Wed, 30 Dec 92 14:42:51 GMT
  10. Lines:       35
  11.  
  12. jlnance@eos.ncsu.edu (JAMES LEWIS NANCE) writes:
  13.  
  14.  
  15. >I am attempting to learn C++.  I have declared a class called list and class
  16. >called generic.  In generic, lspace is declared as:
  17.  
  18. >list **lspace.
  19.  
  20. >Both g++ and cfront tell me that the line containing new in the following 
  21. >constructor has a syntax error.
  22.  
  23. >generic::generic() {
  24. >this->lrow   = 100;
  25. >this->lcol   = 100;
  26. >this->lsize  = 0;
  27. >this->lspace = new *list[lcol];
  28. >this->addrow();
  29. >printf("Constructing element\n");
  30. >}
  31.  
  32. >Can someone tell me what I am doing wrong?
  33.  
  34. If you want to create an array of pointers to lists, try:
  35. `this->lspace = new list*[lcol];'
  36. Note that this statement won't create any list
  37. btw: Why do you explicitly use this?
  38. `lspace = new list*[lcol];' 
  39. will do the same (while being in class scope).
  40. --
  41. Max Kubierschky                    "Don't Bb, but try to C#"
  42. Haendelstr. 20/218
  43. D 7800 Freiburg, West Germany
  44. phone: +49 (761) 53664 or +49 (761) 4014-109
  45. email: max@ise.fhg.de
  46.