Path: utzoo!attcan!uunet!husc6!uwvax!rutgers!mcnc!thorin!tigger!tuck From: tuck@tigger.cs.unc.edu (Russ Tuck) Newsgroups: comp.lang.c++ Subject: "semi_public:" would be useful Message-ID: <4037@thorin.cs.unc.edu> Date: 5 Sep 88 16:02:25 GMT References: <61@cybaswan.UUCP> <1988Sep2.174327.6439@ateng.uucp> Sender: news@thorin.cs.unc.edu Reply-To: tuck@tigger.UUCP (Russ Tuck) Organization: University Of North Carolina, Chapel Hill Lines: 24 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