On Sat, Mar 5, 2011 at 10:57 PM, Marcos Douglas <m...@delfire.net> wrote: > The program below compiles. But if I try to use code completion here > writeln(s.F... > Occurs this error: > test.lpr(8,31) Error: ancestor has same name as class. > > program test; > > {$mode objfpc}{$H+} > > uses SysUtils, Classes; > > type > TStringList = class(Classes.TStringList) > public > function Foo: string; > end; > > function TStringList.Foo: string; > begin > result := 'Foo'; > end; > > var > s: TStringList; > begin > s := TStringList.Create; > writeln(s.Foo); > s.Free; > readln; > end.
Like that: type TMyStringList = Classes.TStringList; TStringList = class(TMyStringList) public function Foo: string; end; ...works fine. Marcos Douglas -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus