[comp.lang.c++] "semi_public:" would be useful

tuck@tigger.cs.unc.edu (Russ Tuck) (09/05/88)

In article <1988Sep2.174327.6439@ateng.uucp> chip@ateng.UUCP (Chip Salzenberg) writes:
>... I made HashTable a friend
>of HashNode.  This allowed easy access to the HashNode "next" pointer but
>_only_ for HashTable member functions.

I have often wanted to allow access to a few class methods only to one or two
other classes, but not to all other classes.  Making these methods public
would give too much access to most classes;  making the few other classes
friends gives those classes too much access.

I wish there were a "semi_public:" construct between "public:" and "private:".
Something like "semi_public(comma_separated_list_of_classes):" to give classes
in the list access to the methods following this construct.  This would allow
more precise control of access protection.

Do agree that something like this would be useful?
Would this cause problems in the language definition or implementation?

	Russ
--
Russell R. Tuck, III                   CSNET: tuck@unc
Computer Science Dept., Sitterson Hall ARPA:  tuck@cs.unc.edu
University of North Carolina           UUCP:  {ihnp4|decvax}!mcnc!unc!tuck
Chapel Hill, NC 27599-3175, USA        Phone: (919) 962-1755 or 962-1932