Path: utzoo!utgpu!attcan!uunet!husc6!rutgers!att!mtuxo!mtgzz!drutx!clive
From: clive@drutx.ATT.COM (Clive Steward)
Newsgroups: comp.lang.c++
Subject: Re: Can we hide the private part of a class ?
Message-ID: <8814@drutx.ATT.COM>
Date: 28 Sep 88 07:32:11 GMT
References: <1358@stratus>
Organization: resident visitor
Lines: 38

From article <1358@stratus>, by hsu@stratus (Yung-Kao Hsu):
> 
> Hi, I am a new subscriber to this group and a semi-new user of GNU C++
> (about 2 months). I am interested in learning whether it is possible to make
> the private part of a class definition invisible ?
> 

It doesn't seem you can make anything truly invisible to the user of
a class without a customized preprocessor, because they're always going
to be able to read the header someplace if the compiler system can.

But one could probably simplify the 'user interface' by doing
something like:

in privatestuff.h:

#define FoosPrivates private:\
    int foo1; \
    char *foo2;		/* etc */

    /*
       be sure not to use any // C++ comments anywhere in this macro, as 
       C preprocessor won't understand them...
    */


then in your main header file for the class:

#include "privatestuff.h"

class foo {
    FoosPrivates;	// yes, the ; is unnecessary, but looks better?

public:

   // etc.

};