[DUG] Accessing an ancestor class private field
Conor Boyd
lists at conor.org.uk
Fri Jun 10 11:20:22 NZST 2005
Todd,
I fear you're going to have to delve into the depths of RTTI (Run Time Type
Information) which is Delphi Win32's idea of reflection, if you're familiar
with the term.
You should be able to access private fields using RTTI, but there are
limitations/requirements and it will require a fair bit of code, and I
haven't done that much work with RTTI (not recently anyway), so can't really
tell you much more.
Googling for "delphi rtti" should get you started...
HTH,
Conor
_____
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Todd Martin
Thanks Conor. I understand that, but I thought there was a way to get at
private fields as well. I know it defeats the purpose of making a field
private, but that's another discussion.
----- Original Message -----
From: Conor Boyd <mailto:lists at conor.org.uk>
If I understand you correctly...
You can increase the visibility of a property in sub-classes by simply
redeclaring the property in a declaration section with greater visibility
(e.g. redeclaring a protected property in the public section), but I don't
think you can for fields.
A title in the Delphi 5 help called "Property overrides and redeclarations"
may provide more information.
Cheers,
Conor
_____
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Todd Martin
I seem to recall someone posting a message showing a hack of how to access a
private field in an ancestor class.
Something along the lines of redeclaring the field in the descendant class.
I've tried to find the solution, but with no luck.
Can someone please remind me. Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20050610/364c6fe0/attachment-0001.html
More information about the Delphi
mailing list