| Subject: | D2010: Strange behaviour of class completion? |
| Posted by: | Ian Stuart |
| Date: | Mon, 30 Aug 2010 |
I am observing a strange behaviour when using the 'Complete class at cursor' command. I've produced a little example of the issue.
****************
unit Unit1;
interface
type
TBase = class
public
function get_V(const Index: Integer): string;
end;
implementation
{ TBase }
function TBase.get_V(const Index: Integer): string;
begin
Result := '';
end;
end.
*************
unit Unit2;
interface
uses
Unit1;
type
TDerived = class(TBase)
private
function get_V(const Index: Integer): string; //<--- WHY
published
public
property S1: string index 0 read get_V;
property S2: string index 1 read get_V;
end;
*************
Suprisingly invoking 'Complete class at cursor' on TDerived creates a private TDerived.get_V function. If TBase is defined in Unit2 along with TDerived then class completion does not create the TDerived.get_V function. My expectation is that the getter from TBase should be used in both cases.
Regards
Ian