Xref: utzoo comp.lang.c++:9790 comp.std.c++:355 Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucrmath!ucrmath.ucr.edu!hawley From: hawley@ucrmath.ucr.edu (brian hawley) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Can this be done? Message-ID: <9033@ucrmath.ucr.edu> Date: 3 Oct 90 13:42:29 GMT Sender: hawley@ucrmath.ucr.edu Followup-To: comp.lang.c++ Organization: University of California, Riverside Lines: 57 Suppose I have the following class definition: class Symbol { public: int a; // in real life, this data area more complex char b; int c; Symbol(); ~Symbol() // and others } Now, I want to set up a data area (separate from this), for prefilling of this data. In c, this would have been a struture, and I could have just said: (of course the functions wouldn't be in the structure) struct Symbol *temp; I realize it isn't much extra space, but in c++ you also have the pointers to the intrinsics, so if I were to "new Symbol", I would be mallocing extra space for those too. I would like to avoid doing that. My first thought was to do something like: class Symbol { public: struct node { int a; // in real life, this data area more complex char b; int c; } Symbol(); ~Symbol() // and others } And then try to declare something like "Symbol::node *temp", or other alternatives along those lines like "symbol = new Symbol(); symbol->node *temp;" However, both of those are invalid in c++ delcarations. What I'm wondering is if there is a way to accomplish what I want, without having to make a new instance of the class, or having to pull the structure outside of the class declaration? Any answers/suggestions? Please e-mail them to hawley@ucrmath.ucr.edu Thanks, Brian ------------------------------------------------------------------------------ Brian N. Hawley Internet: hawley@ucrmath.ucr.edu Dept. of Math & Computer Science uucp: {ucsd, uci}!ucrmath!hawley Univ. of Calif., Riverside, CA 92521 phone: (714) 787-4645