Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2023-12

External class constructor inheritance

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Henrique Gottardi Werlang

Hello!

I need some help with one situation I have here. I created an sample:

unit Main;
{$modeswitch externalclass}
interface
type
   TMyClass = class external name 'C'
   public
     constructor New(ConstructorParam: Integer);
   end;
  TMyAnotherClass = class(TMyClass)
  public
    constructor Create(ConstructorParam: Integer);
  end;
implementation

{ TMyAnotherClass }

constructor TMyAnotherClass.Create(ConstructorParam: Integer);
begin
  inherited;
end;
end.

I need call the external class constructor from the Pascal class constructor. How do I do it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20231216/bb987b62/attachment.htm>

Mattias Gaertner
to Henrique Gottardi Werlang
Henrique Gottardi Werlang wrote 33 lines
Hello! I need some help with one situation I have here. I created an sample: unit Main; {$modeswitch externalclass} interface type TMyClass = class external name 'C' public constructor New(ConstructorParam: Integer); end; TMyAnotherClass = class(TMyClass) public constructor Create(ConstructorParam: Integer); end; implementation { TMyAnotherClass } constructor TMyAnotherClass.Create(ConstructorParam: Integer); begin inherited; end; end. I need call the external class constructor from the Pascal class constructor. How do I do it?

Have you seen:
https://wiki.freepascal.org/Pas2js_Transpiler#External_class_as_ancestor ?

Mattias