Path: utzoo!utgpu!attcan!uunet!lll-winken!ames!hc!pprg.unm.edu!unmvax!tut.cis.ohio-state.edu!cs.utexas.edu!pp!cadillac!redcloud!rpj From: rpj@redcloud.cad.mcc.com (Rich Johns) Newsgroups: comp.lang.c++ Subject: static members Summary: static members Message-ID: <701@cadillac.CAD.MCC.COM> Date: 6 Jan 89 22:20:38 GMT Sender: news@cadillac.CAD.MCC.COM Reply-To: rpj%cad@MCC.COM (Rich Johns) Organization: MCC VLSI-CAD Program, Austin, TX Lines: 35 In Stroustroup on page 275, section 8.5.1 it states: "No initializer can be specified for a static member, and it cannot be of a class with a constructor." This could mean two things(at least): 1) if a class has a constructor, that class may NOT have static members. 2) You cannot have a static data member which needs a constructor. After discussing this with someone, I am inclined to think number 2 is correct. As such are the following assumptions correct: a) a static data member is allowed, as long as: 1) the member does not require a constructor. 2) the member is private b) a static const data member is allowed, as long as: 1) the member does not require a constructor. 2) the member is private c) a static const data member CAN have an initial value. d) a static function member is not allowed. Rich Johns, MCC CAD Program | 3500 W. Balcones Center Dr., Austin, TX 78759 ARPA: johns@mcc.com | Phone: [512] 338-3714 UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!johns