waldemar@mit-vax.LCS.MIT.EDU (Waldemar Horwat) (01/21/89)
Sender: Reply-To: waldemar@mit-vax.UUCP (Waldemar Horwat) Followup-To: Distribution: Organization: MIT Laboratory for Computer Science, Cambridge Keywords: I am having a little problem with maintaining data abstraction in C++. Perhaps someone could help me. Is there any way to define functions which can access the private elements of a class without declaring them in the class declaration? Specifically, I have a class called Widget which, although it has few public methods, has a lot of private utility methods called by those public methods. I don't want to list the declarations of those private methods in the Widget.h header file, but I must if those utility methods are to be able to access Widget's private variables. I can understand why the private variables of a class must be declared for all of the class's users to see, but must the private methods of a class also be declared when the class is declared? Is there any way to state that the functions in the Widget.c file can access Widget's internals without necessarily giving such permission to other source files and without specifying those functions in the Widget.h file? Waldemar Horwat Internet: waldemar@vx.lcs.mit.edu