Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 31,733 of 33,346    |
|    Marsh Ray to Peter C. Chapin    |
|    Re: Private member functions cannot be g    |
|    10 Dec 11 05:56:41    |
      From: marsh@extendedsubset.com              On 12/09/2011 11:28 AM, Peter C. Chapin wrote:              > On 2011-12-09 00:05, pjacobi wrote:              >              >> When f is a private member of class Foo, then class Bar              >> cannot declare Foo::f to be a function friend.              >>              >> Isn't this a bit strange? That function declaration would not give Bar              >> access to Foo internals, just the other way around, as any friend              >> declaration does.              >              > The very existence of Foo::f is part of Foo's internals. Class Bar isn't              > supposed to know that there is such a method as Foo::f. In particular,              > the author of class Foo is free to change or remove Foo::f at their              > whim. Such a change should not be a breaking change since Foo::f is              > private. Yet if class Bar could name Foo::f that code would fail to              > compile after Foo::f is removed.                            Perhaps it would make sense for some future standard to downgrade       unmatched specifiers in friend declarations to a diagnostic message?                            - Marsh                                          --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca