From -8036128545565204036
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,5e585716c0fba88e
X-Google-Attributes: gidf78e5,public
From: croizier@enstb.enst-bretagne.fr (Valery CROIZIER)
Subject: Re: why are private functions part of a class' interface?
Date: 1995/04/13
Message-ID: <CROIZIER.95Apr13154319@gauss.enstb.enst-bretagne.fr>#1/1
X-Deja-AN: 100371588
distribution: world
references: <VLADIMIR.95Apr12160158@tees.cs.ualberta.ca>
content-type: text/plain; charset=US-ASCII
organization: ENSTBR, Brest, France
mime-version: 1.0
newsgroups: comp.std.c++

In article <3mj5b1$nr5@locutus.rchland.ibm.com>
pstaite@powertool.rchland.ibm.com (Philip Staite) writes:

> |> Whenever I add a private helper function to a class, I have to change its
> |> interface in the .h file and thus recompile all dependent classes (unless I

> |>   I think it would be useful to permit member function definitions without
> |> requiring a declaration.

> Also, if I can define a "member" function without the class
> declaring it as a member/friend, this blows encapsulation.  What stops
> me from doing anything I want to the private/protected instance data?


It could be possible to declare private methods without adding them to
the .h file, since you can do it with Ada.
But with C++, the encapsulation is performed *only* by the class
descrition, which is usually in the .h file.
As a result, there is no way you can safely define such a function
outside the .h file and avoid recompiling everything.

--
Valery



