Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - friends _ http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                                 Friends                              _
   A friend is an individual function (or all of the member functions  in
   a  class)  which  has special access privileges  to  the  private  and
   protected members of another class. As implied above, a friend can  be
   either a single function or a whole class. A friend function or  class
   must be named within the class definition of the class which it is  to
   access, using the friend keyword:

   class Myclass
   {
   friend Otherclass;
   //Otherclass is a friend
   friend int Third::count(int x);
   //function count of
   // class Third is a friend
   //rest of class definition
   };
   A friend declaration may only appear within a class definition.
   Note that in order to declare a member function of another class as  a
   friend,  the  class  definition for that class  must  have  been  seen
   previously.  A  forward  declaration of  the  class  is  insufficient,
   although  it  will  allow the class as a whole to  be  declared  as  a
   friend.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson