🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Separate Decl of Private Member Fcn

#256
From: stt
Date: Thu, 02 Aug 1990 21:54
29 lines
1600 bytes
It seems to be a major maintenance/recompilation headache that any
private utility function which is to be used to implement
public member functions must be declared in the class declaration,
either as a private member function, or as a friend.

It would seem much better to allow a separate place to
specify the set of private (utility/helper) member/friend functions,
or to simply allow private member functions to be declared/defined
outside of the class declaration.

This issue is discussed in E&S 9.3, bottom of page 174, but
I find the argument unconvincing:

   "Why can't functions be added to a class after the end
    of the class declaration?  If this were allowed, a user 
    could gain access to a class simply by declaring an additional
    function."

This is one of the rare "we don't trust the programmer" situations
in C or C++.  The name of the function is going to require
the class qualifier in its definition,
so it will be obvious what is going on.  It is necessarily
going to be private (I assume), so it is only callable
from other member functions.  Where is the danger?

S. Tucker Taft
Intermetrics, Inc.
Cambridge, MA  02138
Technical Details
Message-ID: <259400001@inmet>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!stt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!stt
From: stt@inmet.inmet.com
Newsgroups: comp.std.c++
Subject: Separate Decl of Private Member Fcn
Message-ID: <259400001@inmet>
Date: 2 Aug 90 21:54:00 GMT
Lines: 29
Nf-ID: #N:inmet:259400001:000:1156
Nf-From: inmet.inmet.com!stt    Aug  2 17:54:00 1990