home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!gumby!wupost!cs.uiuc.edu!sparc0b!pjl
- From: pjl@cs.uiuc.edu (Paul Lucas)
- Subject: Re: Help with nested class and constructor
- Message-ID: <Bxz448.4nv@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <Bxyxrv.EJ3@news.cso.uiuc.edu>
- Distribution: usa
- Date: Thu, 19 Nov 1992 17:19:20 GMT
- Lines: 31
-
- In <Bxyxrv.EJ3@news.cso.uiuc.edu> macg9505@uxa.cso.uiuc.edu (Michael Alan Corn) writes:
-
-
- >I could use a little help on nested classes:
- > I would like to include one of Borlands Array classes in another class,
- >in the private data section, but since the constructor requires an int to
- >initialize the class, I'm not sure how or where to give it the value:
-
- >class foo {
- > private:
- > Array myarray(10); ///this doesn't work, the compiler chokes
-
-
- *****> foo::foo() : myarray(10) {/*...*/}
-
- Look up mem-initializer in the C++ you have.
-
- >so I've tried this, which seems to work
-
- >class foo {
- > private:
- > void *myarray;
-
- *****> Why void*? How about Array*? Of course, if you do the first
- thing above, you needn't do anything else.
-
- [remainder elided]
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-