i want to overload a procedure in a class. for this i wrote:
type
TMyClass = class(TObject)
private...
...
public
constructor create;
destructor destroy;
procedure dosomething(filename: string); overload;
procedure dosomething(s: string; t: string; u: string); overload;
implementation
procedure dosomething(filename:string);
begin
end;
procedure dosomething(s: string; t: string; u: string);
begin
end;
but delphi tells me an error regarding forward- or external declaration error...
why is that?
thanks in advance!
you must add the class name ...
implementation
procedure TMyClass.dosomething(filename:string);
begin
end;
procedure TMyClass.dosomething(s: string; t: string; u: string);
begin
end;
It probably tells you that you are missing the implementation of your constructor and destructor. This program compiles:
program Project1;
{$APPTYPE CONSOLE}
type TMyClass = class(TObject)
public
procedure doSomething(const Filename: string); overload;
procedure doSomething(const s, t, u: string); overload;
end;
{$R *.res}
{ TMyClass }
procedure TMyClass.doSomething(const Filename: string);
begin
end;
procedure TMyClass.doSomething(const s, t, u: string);
begin
end;
begin
writeln('blubb');
end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With