1

I'm using Delphi XE3, and I need to override a property in a such way, that I still call base class getter and a new class setter.

Example:

TBaseClass = class
  ...
  property XML:string read GetXML write SetXML;
end ;

TNewClass = class(TBaseClass)
  ...
  property: XML .....
end;

UPDATE:

The BaseClass is in a .dcu compiled file, so I can't directly change this file.

4

1 回答 1

5

My problem was solved with this approach:

in TNewClass:

private
  function GetXML: string;
  procedure SetXML(const Value: string);

public
  property XML: string read GetXML write SetXML;

procedure TNewClass.SetXML(const Value: string);
begin
  do my job..
end;


function TNewClass.GetXML: string;
begin
  //here call the base GetXML      
  result := Inherited XML;//result := string(Inherited XML);
end;
于 2013-09-11T14:05:49.700 回答