Topic: static members and access control?
Author: LANG@nvdv01.ind.e-technik.uni-stuttgart.de (MARTIN LANG)
Date: Mon, 5 Oct 1992 12:52:29 GMT Raw View
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