🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #32

Re: Private static member functions

#32
From: Patrick Smith
Date: Tue, 03 Nov 1992 00:23
34 lines
1487 bytes
stt@spock.camb.inmet.com (Tucker Taft) writes:
|It would be very useful to allow private static member
|functions to be declared outside the class declaration.
|For example:
|      private static void C::helper(C* p)
|      {
|           /* This function does something useful */
|           /* that depends on access to private members of C */
|      }
|Such a declaration would be visible within its file only, and
|only to other member functions of the same class (or their
|friends in the same file).
|
|This could dramatically reduce recompilation problems
|in environments where any change to a ".h" causes massive
|recompilation.

Since you're only asking for this for static member functions,
you can get pretty much the same effect in the existing language,
by using a friend class.

   class C {
      // ...
      friend class FriendOfC;
   };

Put the static member functions in FriendOfC instead of C; then
you can add or remove functions without forcing the users of C
to recompile.

-- 
Patrick Smith
uunet.ca!frumious!pat
pat%frumious.uucp@uunet.ca
Technical Details
Message-ID: <1992Nov3.002354.672@frumious.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uunet.ca!frumious!pat
References: <1992Nov2.152918.469@inmet.camb.inmet.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uunet.ca!frumious!pat
From: pat@frumious.uucp (Patrick Smith)
Subject: Re: Private static member functions
Message-ID: <1992Nov3.002354.672@frumious.uucp>
Date: Tue, 3 Nov 1992 00:23:54 GMT
Reply-To: uunet.ca!frumious!pat
References: <1992Nov2.152918.469@inmet.camb.inmet.com>
Organization: None
Lines: 34