Topic: Access specifiers for friends - why not?
Author: howland@us-es.sel.de (Gary Howland US/END 60/1/25)
Date: Wed, 9 Mar 94 10:51:52 GMT Raw View
In article <CLr7GH.1C8@cbnewse.cb.att.com>, grumpy@cbnewse.cb.att.com (Paul J Lucas) writes:
> From article <1994Feb24.165437.27844@us-es.sel.de>, by howland@us-es.sel.de (Gary Howland US/END 60/1/25):
> > Anyhow, the question is, why can't access specifiers be applied to
> > friend declarations? I can't think of any reason against it.
>
> That's ok, I can't think of any reason for it. If you expect
> some proposal to be taken seriously, then you have to at least
> explain the semantics of it.
> --
> - Paul J. Lucas
> AT&T Bell Laboratories
> Naperville, IL
It makes sense to me that we could use syntax such as
class X
{
protected friend class Y;
...
};
to allow class Y access to public & protected (but not private) members of
class X. This would encapsulate the class a little more, which is surely a good thing. I have heard of developers (and been tempted myself) who inherit from class X before adding the friend declaration in order to achieve the same results as above (although this makes the code less readable).
--
Gary Howland (howland@us-es.sel.de)
Be sure to use the above email address - sometimes the return address is broken.
Author: howland@us-es.sel.de (Gary Howland US/END 60/1/25)
Date: Thu, 24 Feb 94 16:54:37 GMT Raw View
Many apologies if this is a second posting, but I think my first posting wasn't to world.
Anyhow, the question is, why can't access specifiers be applied to friend declarations? I can't think of any reason against it.
Gary
--
Gary Howland (howland@us-es.sel.de)
Be sure to use the above email address - more often than not the return address
is knackered - not my fault honest :-).
Author: grumpy@cbnewse.cb.att.com (Paul J Lucas)
Date: Fri, 25 Feb 1994 00:17:03 GMT Raw View