hawley@ucrmath.ucr.edu (brian hawley) (10/03/90)
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