[DUG] Accessing an ancestor class private field
Todd Martin
toddm at kol.co.nz
Fri Jun 10 13:05:54 NZST 2005
Hi Connor.
I already knew I couldn't use RTTI. Kyley's solution was what I was looking
for.
Cheers,
T.
----- Original Message -----
From: "Conor Boyd" <lists at conor.org.uk>
To: "'NZ Borland Developers Group - Delphi List'" <delphi at ns3.123.co.nz>
Sent: Friday, June 10, 2005 12:16 PM
Subject: RE: [DUG] Accessing an ancestor class private field
> Fair enough.
>
> Like I indicated earlier, I don't really have enough experience in this
> particular area to comment on the limits of RTTI, but I thought it was
> worth
> Todd investigating.
>
> Cheers,
>
> C.
>
> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
> On
> Behalf Of Kyley Harris
>
> I think you need to accept that it is not possible to access a private
> variable using RTTI unles it was exposed via a published property, as is
> the
> case of FITems in TCollection.
>
> What I proposed is and always will be a hack, and is not the easiet or
> fastest way. The "Real" way is to design an object with inheritance in
> mind
> and make things accessible. This is not always possible, so you refactor
> the
> code. So people don't like to refactor classes.pas, because its library
> source. I'll change it just as fast as I'll change 3rd party source, if it
> has a bug in it.
>
> So my debatable opinion is to refactor the code. RTTI is a useful tool
> that
> works on a correctly designed object, but it is not a getaround to private
> variables
>
> On 6/10/05, Conor Boyd <lists at conor.org.uk> wrote:
>>
>> I still think RTTI is the only "real" way, but I accept it's more work
>> than yours or Kyley's suggestions.
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>
--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.5.1 - Release Date: 2/06/2005
More information about the Delphi
mailing list