Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-unix!hplabs!hplabsc!kempf From: kempf@hplabsc.UUCP Newsgroups: comp.lang.c++ Subject: Some Questions Message-ID: <1207@hplabsc.UUCP> Date: Fri, 6-Feb-87 11:48:59 EST Article-I.D.: hplabsc.1207 Posted: Fri Feb 6 11:48:59 1987 Date-Received: Sun, 8-Feb-87 01:15:03 EST Organization: Hewlett-Packard Laboratories Lines: 48 I am posting these questions for a friend of my, who is very shy. Please reply via. e-mail, unless the responses may be of general interest. Thank you. Jim Kempf kempf@hplabs.hp.com ---------------------------------------------------------------------- I have three questions about c++ (in particular version 1.1). Question 1: Is there any reason that initialization of static members couldn't be allowed. The version 1.1 compiler gives an error message when an initializer is present for a static member, and "THE BOOK" claims (page 275): No initializer can be specified for a static member, and it cannot be of a class with a constructor. What is the technical reason for this? I have not been able to think of any reason that this shouldn't be legal given that static variables can be initialized. Question 2: What are the semantics of a private constructor? It seems to me that a private constructor should be invisible outside of members (and friends) of a class. Yet the compiler (version 1.1) does not seem to enforce this. Is this a bug in the compiler, or am I missing something? Question 3: The following file compiles without error under version 1.1 on our machine. It seems to me that it should complain about the arguments to the constructor since no constructor that accepts arguments has been declared. Am I missing something or is this a bug in the compiler? #include class foo { char c; long l; float f; friend ostream& operator<<(ostream&, foo&); }; void bar() { foo* p = new foo('a', 13, 99.9); cerr << *p; }