Newsgroups: comp.lang.c++
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!stanford.edu!neon.Stanford.EDU!pescadero.Stanford.EDU!philip
From: philip@pescadero.Stanford.EDU (Philip Machanick)
Subject: Re: Public vs Private header files in C++
Message-ID: <1991Jun3.222844.19237@neon.Stanford.EDU>
Sender: news@neon.Stanford.EDU (USENET News System)
Reply-To: philip@pescadero.stanford.edu
Organization: Stanford University
References: <5243@servax0.essex.ac.uk> <5tdHm72m@cs.psu.edu>
Date: Mon, 3 Jun 1991 22:28:44 GMT
Lines: 30

In article <5tdHm72m@cs.psu.edu>, schwartz@groucho.cs.psu.edu (Scott Schwartz) writes:
|> 
|> jbuck@forney.berkeley.edu (Joe Buck) writes:
|>    Stroustrup said something about this: the member access system is designed
|>    to protect against accidents, not maliciousness.  
|> 
|> An then on page 253 gives an example of language features designed to
|> prevent maliciousness (noninheritance of friendship), using an example
|> named "class Spy".
|> 
|>    Someone determined to defeat the type system wouldn't find it much
|>    harder to do with Modula-2.
|> 
|> That's no excuse for encouraging it.
I'm not really sure this Modula-2 comparison is valid. In C++,
the mechanism for information hiding between separately compiled
modules is really statics (which cannot be seen across
compilations). Classes are a finer-grained mechanism, provided
more for abstraction than security in the anti-malice sense. I
imagine a lot of Modula-2 modules are more like a single C++ file
containing lots of classes, than like one C++ class. Otherwise,
managing compilation and dependencies is too complicated. (Are
there people who make one file per class / data abstraction?)

Whether the Modula-2 mechanism is better is another matter,
but let's compare like features if we are going to compare
anything.
-- 
Philip Machanick
philip@pescadero.stanford.edu
