home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!math.fu-berlin.de!news.belwue.de!sun1.ruf.uni-freiburg.de!ise.fhg.de!usenet
- From: max@ise.fhg.de (Max Kubierschky)
- Subject: Re: Newing a pointer to a pointer
- Message-ID: <max.725726173@ise.fhg.de>
- Sender: usenet@ise.fhg.de
- Organization: FhG-ISE - Institute for Solar Energy Systems
- References: <1992Dec29.174843.20250@ncsu.edu>
- Date: Wed, 30 Dec 92 14:42:51 GMT
- Lines: 35
-
- jlnance@eos.ncsu.edu (JAMES LEWIS NANCE) writes:
-
-
- >I am attempting to learn C++. I have declared a class called list and class
- >called generic. In generic, lspace is declared as:
-
- >list **lspace.
-
- >Both g++ and cfront tell me that the line containing new in the following
- >constructor has a syntax error.
-
- >generic::generic() {
- >this->lrow = 100;
- >this->lcol = 100;
- >this->lsize = 0;
- >this->lspace = new *list[lcol];
- >this->addrow();
- >printf("Constructing element\n");
- >}
-
- >Can someone tell me what I am doing wrong?
-
- If you want to create an array of pointers to lists, try:
- `this->lspace = new list*[lcol];'
- Note that this statement won't create any list
- btw: Why do you explicitly use this?
- `lspace = new list*[lcol];'
- will do the same (while being in class scope).
- --
- Max Kubierschky "Don't Bb, but try to C#"
- Haendelstr. 20/218
- D 7800 Freiburg, West Germany
- phone: +49 (761) 53664 or +49 (761) 4014-109
- email: max@ise.fhg.de
-