Johann Glaser schreef:
Hi!
How can I access an inherited inherited method which was overloaded?
Try the following, mark the constructors as overloaded:
====== Example: ======
{$mode objfpc}{$H+}
Program TestInherited;
Uses Classes, SysUtils;
Type
TFirst = class
Constructor Create(A,B,C:Integer); overload;
End;
TSecond = class(TFirst)
Constructor Create(A,B:Integer); overload;
End;
TThird = class(TSecond)
Constructor Create(A,B:Integer); overload;
End;
Constructor TFirst.Create(A, B, C: Integer);
Begin
{ ... }
End;
Constructor TSecond.Create(A, B: Integer);
Begin
inherited Create(A,B,0);
End;
Constructor TThird.Create(A, B: Integer);
Begin
inherited Create(A,B,0); { <-- Error: Wrong number of parameters specified for call
to "Create" }
End;
Begin
End.
===================================
The compiler complains in TThird.Create that the call to the inherited
method doesn't work. Removing the word "inherited" doesn't help.
What happened to the method with 3 parameters? Why is there an error
message? How can I access it?
The constructor with 3 parameters is hidden.
Vincent
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal