Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!portal!cup.portal.com!pkturner From: pkturner@cup.portal.com (Prescott K Turner) Newsgroups: comp.lang.c++ Subject: Re: How to reference a member? Message-ID: <30585@cup.portal.com> Date: 7 Jun 90 03:29:33 GMT References: <25695@netnews.upenn.edu> Organization: The Portal System (TM) Lines: 21 Menq-Juh Lee writes: > struct Person { > String name(25); > int age; > }; You can't give the argument to String's constructor in the declaration of Person. A C++ compiler should reject the above declaration of the 'name' member. Try: struct Person { String name; int age; Person(); // default constructor for Person }; Person::Person : name(25) {} // constructor definition initializes 'name' -- Prescott K. Turner, Jr. Language Processors, Inc. 959 Concord St., Framingham, MA 01701 USA (508) 626-0006 x232 UUCP: ...sun!cup.portal.com!pkturner Internet: pkturner@cup.portal.com