Re: Private vs. protected functions for refactoring
Niklas Matthies wrote:
On 2006-09-10 18:09, James Kanze wrote:
Roy Smith wrote:
Any thoughts on how to approach the private-vs-protected issue?
Protected is, despite the name, part of the public interface
(unless the hierarchy is closed, i.e. you control all of the
derived classes).
Once an instance has been created, protected members certainly
aren't part of the public interface for that instance.
If you're talking about runtime, nothing is protected---the
bytes are always accessible. Access control is purely a compile
time mechanism. (I think that there is one exception with
regards to exception handling, but that's it.) If a client can
access something in your class, it's part of your interface.
Making it protected, rather than public, means that the client
has to go to a little more effort to access it, but anything
that is protected still needs a documented contract, which is
guaranteed for all future versions. Just like public.
--
James Kanze GABI Software
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]