[comp.lang.c++] Data vs. function members

jss@hector.UUCP (Jerry Schwarz) (04/21/88)

In article <6590039@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes:
>
>Again, not true -- the issue is public vs non-public, it is not an issue
>of access functions or not access functions.  Change the meaning of 
>any part of your public interface, either instance variable or function, 
>and your class's users will be hosed.

It is easy to overlook a subtle point.  When you make available a
value through a member function, the only thing you are putting into
the public interface is access to a value.  When you make it
available as a data member you are also putting into the interface
the operation of changing that value.  Further you are committing
yourself to the implmentation of this operation as a simple
assignment.

Whether you want to put the assignment operation into the interface
is a decision to be made individually for each value.  My experience
has been that the commitment to an implementation of assignment is a
significant constraint on future changes to a class.  

Jerry Schwarz
Bell Labs, Murray Hill