[DUG] Accessing an ancestor class private field
Kyley Harris
kyleyharris at gmail.com
Fri Jun 10 11:58:06 NZST 2005
> I still think RTTI is the only "real" way, but I accept it's more work than
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.
>
> Cheers,
>
More information about the Delphi
mailing list