1
votes

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.

1
Declare SetXML virtual in TBaseClass and override it in TNewClass.Sertac Akyuz
why does this question got protected? from the answers I do not see any reason for doing thisRBA
@RBA: This question is protected because of spam messages. Someone has recently been posting nasty things towards one particular SO member, and this discussion had received some of those messages, which have been deleted.Remy Lebeau

1 Answers

5
votes

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;