Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!netnews.upenn.edu!grad1.cis.upenn.edu!menqjuh From: menqjuh@grad1.cis.upenn.edu Newsgroups: comp.lang.c++ Subject: How to reference a member? Message-ID: <25695@netnews.upenn.edu> Date: 5 Jun 90 01:09:05 GMT Sender: news@netnews.upenn.edu Reply-To: menqjuh@grad1.cis.upenn.edu () Organization: University of Pennsylvania Lines: 33 When I compile the following segment of code by g++(1.36), I get the error message "structure has no member named `name'." ============================================================ #include class String { int length; char *head; public: String(int len) { head = new char[length = len + 1]; } }; struct Person { String name(25); int age; }; main() { Person pp; pp.name; // This reference is *not* allowed. WHY? } ============================================================ Is this behavior normal or abnormal? In my case, `name' is desired to be of `String' type instead of `String*' type, and the length of the `name' (25 above) is subject to change. Any help will be appreciated. Menq-Juh Lee