Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!iuvax!pur-ee!uiucdcs!uiucdcsp!spalding From: spalding@uiucdcsp.UUCP Newsgroups: comp.lang.c++ Subject: Re: static class member restriction Message-ID: <77300006@uiucdcsp> Date: Tue, 24-Nov-87 19:09:00 EST Article-I.D.: uiucdcsp.77300006 Posted: Tue Nov 24 19:09:00 1987 Date-Received: Sun, 29-Nov-87 06:42:51 EST References: <181@sdti.UUCP> Lines: 21 Nf-ID: #R:sdti.UUCP:181:uiucdcsp:77300006:000:699 Nf-From: uiucdcsp.cs.uiuc.edu!spalding Nov 24 18:09:00 1987 It's ok for a static object to be a "member of" a class with a constructor, but not ok for a static member object to be "of" a class with a constructor. Thus, in the following example, x is "of" class inner, which has a constructor, and therefore may not be a "member of" class outer. It doesn't matter whether class outer has a constructor or not. This restriction is probably imposed because it is not clear when the constructor should be called. The following example was run with cfront 1.2.1 on a VAX: class inner { int n; inner(); }; class outer { static inner x; }; CC test.c: "test.c", line 8: sorry, not implemented: static member outer::x of class inner with constructor 1 error