[fpc-pascal] class of - instance created is wrong

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 15 10:36:02 CET 2012


Graeme Geldenhuys <graemeg.lists at gmail.com> hat am 15. März 2012 um 10:07
geschrieben:

>[...]
>   TfpgCanvas
>    |
>    +-- TfpgX11Canvas
>         |
>         +-- TfpgCanvasBase
>
>
>   TAgg2D
>    |
>    +-- TfpgCanvasBase
>[...]
>   DefaultCanvasClass: TfpgCanvasBaseClass = nil;
> [...]
> function TfpgWindow.CreateCanvas: TfpgCanvasBase;
> begin
>   writeln('>> TfpgWindow.CreateCanvas');
>   writeln('     DefaultCanvasClass = ' + DefaultCanvasClass.ClassName);
> //  result := TAgg2D.Create(self);
> //  result := TfpgCanvas.Create(self);
>   Result := DefaultCanvasClass.Create(self);
>   writeln('<< TfpgWindow.CreateCanvas');
> end;
> [...]
>   creating... TfpgX11Canvas
>   creating... TfpgCanvasBase
>
> NOTE the missing TfpgCanvas. Needless to say my program crashes
instantly.
>[...]
> Can anybody see what I am doing wrong?


Is the constructor virtual?



> I've tested with FPC 2.6.0, 2.6.1 and 2.7.1 under 64-bit Linux. All
compilers give the same
> results.

>[...]

Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120315/d50c3cdd/attachment.html>


More information about the fpc-pascal mailing list