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.)
Share
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
privateorstrict privatemembers with class helpers does not work. It was considered a compiler bug and has been corrected. Accessingprotectedorstrict protectedmembers 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.