From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,8ff80a74f45b5cd3 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,8ff80a74f45b5cd3 X-Google-Attributes: gid103376,public From: "Gavin Collings" Subject: Re: Visibility and access to "public" attributes Date: 1997/09/02 Message-ID: <01bcb794$ec55a590$7e80400a@gavinspc>#1/1 X-Deja-AN: 269516245 References: <01bcb787$eeb5a180$7e80400a@gavinspc> <340BF0B7.BF7D3029@calfp.co.uk> X-NNTP-Posting-Host: firewall2.sperry-sun.co.uk [193.195.187.67] Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-09-02T00:00:00+00:00 List-Id: Nick Leaton wrote in article <340BF0B7.BF7D3029@calfp.co.uk>... > Gavin Collings wrote: > > > > Don Harrison wrote in article > > > What remains, of course, is the fact that the Eiffel mechanism is simpler > > > and more direct - objectively-speaking, that is. :) > > > > ... than Ada ... Agreed. Would you care to contrast the Eiffel mechanism > > (objectively, of course) with that specified for Delphi properties. Here I > > have complete freedom to define within say class circle. > > > > [snip radius property example] > > > > Apart, perhaps, from the overhead of having to declare fRadius separately, > > this method looks certainly more flexible and probably in most interesting > > cases more direct than the Eiffel approach. > > > > A bit obscure. Lets say you also have area as a readable atribute. > Setting the area is possible, since we can derive the radius as a > consequence. How does > that work with Delphi. I'm not entirely sure what you mean, but if your asking can you define an Area property that defines side effects which act purely on the radius, the answer is yes. It works like this: property Area : Double read GetArea write SetArea Then you can define the accessors - e.g. SetArea: procedure SetArea( newArea : Double ) begin fRadius := sqrt( newArea / pi ); end Now I can write client code like: circle1.Area := 50.0; You have complete control over which properties are read-only/read-write and which directly access their respective fields (e.g. fRadius) or go via an accessor method. If you meant something else, you'd better elaborate a little. -- Gavin Collings gcollings@sperry-sun.com