Article View: comp.std.c++
Article #749static members and access control?
From: MARTIN LANG
Date: Mon, 05 Oct 1992 12:52
Date: Mon, 05 Oct 1992 12:52
31 lines
1283 bytes
1283 bytes
Follwing a short class declaration with a private static field of an
enumaration type. The enumaration is also declared private. The question
now is: is the initialization illegal or not.
I have tried it with two different compilers. Cfront compiles without
error, Zortech complains because the enumaration is private. The ARM is
not quite clear at this point. In chapter 11 page 239 it states:
private: that is, its name can be used only by member functions and
friends of the class in which it is declared.
In my opinion a static member is neither a member function nor a friends.
Does this mean that Cfront is wrong?
class Test
{
private:
enum E1 { a,b};
static E1 e;
};
E1 Test::e=Test::a;
Thanks,
Martin Lang
University of Stuttgart
Technical Details
Message-ID:
<1992Oct5.125229.16744@news.uni-stuttgart.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.uni-stuttgart.de!newsShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.uni-stuttgart.de!news From: LANG@nvdv01.ind.e-technik.uni-stuttgart.de (MARTIN LANG) Subject: static members and access control? Message-ID: <1992Oct5.125229.16744@news.uni-stuttgart.de> Sender: news@news.uni-stuttgart.de (USENET News System) Organization: University of Stuttgart, IND (FRG) Date: Mon, 5 Oct 1992 12:52:29 GMT X-News-Reader: VMS NEWS 1.23 Lines: 31