Access a strict protected property of a Delphi class?

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.)

Answers


This class helper example compiles fine :

type
  TMyOrgClass = class
  strict private
    FMyPrivateProp: Integer;
  strict protected
    property MyPrivateProp: Integer read FMyPrivateProp;
  end;

  TMyClassHelper = class helper for TMyOrgClass
  private
    function GetMyPublicProp: Integer;
  public
    property MyPublicProp: Integer read GetMyPublicProp;
  end;

function TMyClassHelper.GetMyPublicProp: Integer;
begin
  Result:= Self.FMyPrivateProp;  // Access the org class with Self
end;

Some more information about class helpers can be found here : should-class-helpers-be-used-in-developing-new-code


Need Your Help

WPF Shadow Effects

wpf xaml shadow

I am trying to replicate a screen made by designers through code but I am having trouble with a shadow effect that they have included in the design. This is the shadow effect they have implemented:...

how to run while loop for some milisecond in linux kernel?

c linux time timer linux-kernel

i need to do some polling in Linux kernel for continues some time so i need to design while loop that exits after some milliseconds interval. So how can i do that?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.