Path: utzoo!utgpu!attcan!uunet!super!udel!gatech!stratus!hsu
From: hsu@stratus (Yung-Kao Hsu)
Newsgroups: comp.lang.c++
Subject: Can we hide the private part of a class ?
Keywords: private, public, interface
Message-ID: <1358@stratus>
Date: 7 Sep 88 15:55:34 GMT
Sender: uucp@super.ORG
Organization: Georgia Institute of Technology
Lines: 37


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 ?

In Ada, a user-defined data structures can be made invisible by decalaring
their types as "private". While in Modula-2, you can do the same thing by
exporting the name of the type but not its definition. The data structures
are then declared in the body of the packages or implementation modules.
Besides the type information, these two languages also allow you to hide
the variables associated with the packages and definition modules.

This features make package/module interfaces cleaner (you don't see any
implementation information at all), and there are more advantages.
But, I couldn't find anything similiar in C++ !!

To make my question clearer, consider the following C++ class definition:

	class X { int x[10]; \\ private decalarations
		  public:
		  W,X, ...
		};

My question: is there anyway I can write this definition as:

	class X {
		public:
		W,X, ...
		};

while declaring "int x[10]" elsewhere (in separate file that is not
accessable by users of this class).

Can anyone answer me ?

Yung.
------