home bbs files messages ]

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,731 of 33,346   
   Peter C. Chapin to pjacobi   
   Re: Private member functions cannot be g   
   09 Dec 11 09:28:31   
   
   273aefe0   
   From: PChapin@vtc.vsc.edu   
      
   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.   
      
   Peter   
      
      
   --   
         [ 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