Overload / Override the constructor



Smart Mobile Studio supports implicit overload, so you can both overload/override the constructor, when "override" is used, an implicit overload is accepted (but it can be explicit). The following script reproduces this nice feature.
Pas2JS pascal source code
{ filename: C.pas } unit C; interface uses SmartCL.System; type TApp = class public procedure DoIt; end; type TCustomScene = class private FA: Integer; FB: Integer; FC: Integer; FApp: TApp; protected constructor Create(App: TApp); overload; procedure PA; virtual; abstract; procedure PB; virtual; abstract; procedure PC; virtual; abstract; procedure PD; virtual; abstract; procedure PE; virtual; abstract; public constructor Create; overload; virtual; abstract; property App: TApp read FApp; property A: Integer read FA; property B: Integer read FB; property C: Integer read FC; end; type TMyScene = class(TCustomScene) protected procedure PA; override; procedure PB; override; procedure PC; override; procedure PD; override; procedure PE; override; public constructor Create; override; constructor Create(a : Integer); overload; end; implementation { TApp } procedure TApp.DoIt; begin WriteLn('doing it'); end; { TCustomScene } constructor TCustomScene.Create(App: TApp); begin FApp := App; end; { TMyScene } constructor TMyScene.Create; begin end; constructor TMyScene.Create(a: Integer); begin end; procedure TMyScene.PA; begin end; procedure TMyScene.PB; begin end; procedure TMyScene.PC; begin end; procedure TMyScene.PD; begin end; procedure TMyScene.PE; begin end; end. { filename: uMain.pas } var myScene : TMyScene; myScene := TMyScene.Create(20); myScene.App.DoIt; //displays 'doing it'