[fpc-pascal] Class helper method overloading ?
Michael Van Canneyt
michael at freepascal.org
Wed Oct 12 13:24:39 CEST 2016
On Wed, 12 Oct 2016, LacaK wrote:
> Hi,
>
> is there posibility introduce in class helper method with same name like in
> base class ?
>
> For example:
>
> TSQLQueryHelper = class helper for TSQLQuery
> public
> procedure ExecSQL(const ASQL: string; const Args: array of const);
> overload;
> end;
>
> procedure TSQLQueryHelper.ExecSQL(const ASQL: string; const Args: array of
> const);
> begin
> SQL.Text := Format(ASQL, Args);
> ExecSQL; // here I want call ExecSQL of TSQLQuery, but compiler complains
> about wrong number of parameters
> end;
>
> When I use:
> inherited ExecSQL;
>
> it compiles (and why is there need to use "inherited", when I use overload
> and there exists method ExecSQL without parameters?)
>
> , but later I get again error "Wrong number of parameters specified for call
> to "ExecSQL"",
> when I want use ExecSQL('',[]) in instance of TSQLQuery
Why not create a descendent class simply ?
Michael.
More information about the fpc-pascal
mailing list