I need to access a strict protected property, because I need to create a validation (based in the value of this property) to avoid a bug. (I don't have the source code of the third party class which has this property) only I have the definition of the class (interface) and the dcu (so I can't change the property visibility). The question is Exist a way to access a strict protected property? (I really read the Hallvard Vassbotn Blog, but I don't find anthing about this particular topic.)
相关问题
- Is there a Delphi 5 component that can handle .png
- Is there a way to install Delphi 2010 on Windows 2
- Is TWebBrowser dependant on IE version?
- iOS objective-c object: When to use release and wh
- DBGrid - How to set an individual background color
相关文章
- Best way to implement MVVM bindings (View <-> V
- Windows EventLog: How fast are operations with it?
- How to force Delphi compiler to display all hints
- Coloring cell background on firemonkey stringgrid
- HelpInsight documentation in Delphi 2007
- Can RTTI interrogate types from project code at de
- What specifically causes EPrivilege to be raised?
- Equivalent to designer guidelines in code
This class helper example compiles fine :
Some more information about class helpers can be found here : should-class-helpers-be-used-in-developing-new-code
Update
Starting with Delphi 10.1 Berlin, accessing
private
orstrict private
members with class helpers does not work. It was considered a compiler bug and has been corrected. Accessingprotected
orstrict protected
members is still allowed with class helpers though.In the above example access to a private member was illustrated. Below shows a working example with access to a strict protected member.
You can use a variant of the standard
protected
hack.Unit 1
Unit 2
Unit 3
Strict protected only allows you to access the member from the defining class, and subclasses. So you have to actually implement a method on the cracking class, make it public, and use that method as the route into the target strict protected member.