Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c++ Subject: Re: access functions Message-ID: <3584@haddock.ISC.COM> Date: 22 Apr 88 16:43:11 GMT References: <8063@apple.Apple.Com> <6590039@hplsla.HP.COM> <11152@mimsy.UUCP> <5547@columbia.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 13 In article <5547@columbia.edu> fox@convent.columbia.edu (David Fox) writes: >There is really no need for the parentheses after a function that >takes no arguments. [If the parens were supplied by the compiler,] >then you could start with a public member and later change it to an >access function without hosing your clients. Only if the clients have been treating the variable as if it were an access function. `zi = z.imag' works fine, but anyone who used `z.imag = zi' would be hosed. (Using an lfunction (i.e. having imag() return a reference) doesn't solve it either; in the most general case you need separate access and store functions. In the complex-number example, the store function is usually just the constructor.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint