[SOLVED] Use Create (class) with parameters and overload lazarus / 21-General ---------------------------------------------------------------------- Hansvb · 2021-08-02 08:40 hi, This is not allowed ? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constructor Create(ConnectionName, Password, SchemaName, DatabaseName : String); begin  inherited;  --> Goes wrong:  oracleconnectionmaintain.pas(107,12) Error: Wrong number of parameters specified for call to "Create"end; My base class is: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit SQliteConnection; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Settings, SQLite3Conn, SQLDB; type   { TSQliteConnection }   TSQliteConnection = class(TObject)     private      FAppDatabaseFolder, FAppDatabaseFile : String;       function GetAppDatabaseFile: String;      function GetAppDatabaseFolder: String;      procedure SetAppDatabaseFile(AValue: String);      procedure SetAppDatabaseFolder(AValue: String);      protected      SQLite3Conn: TSQLite3Connection;      SQLTransaction: TSQLTransaction;     public      constructor Create; overload;      destructor Destroy; override;      property AppDatabaseFolder : String Read GetAppDatabaseFolder Write SetAppDatabaseFolder;      property AppDatabaseFile : String  Read GetAppDatabaseFile Write SetAppDatabaseFile;   end; implementation { TSQliteConnection } {%region Properties}...{%endregion Properties} constructor TSQliteConnection.Create;begin  inherited;  AppDatabaseFolder := ExtractFilePath(ParamStr(0));  AppDatabaseFile := AppDatabaseFolder + Settings.DatabaseFolder + PathDelim + Settings.DatabaseName;   SQLite3Conn := TSQLite3Connection.Create(nil);  SQLTransaction := TSQLTransaction.Create(nil);   SQLite3Conn.Transaction := SQLTransaction;  SQLTransaction.DataBase := SQLite3Conn; end; destructor TSQliteConnection.Destroy;begin  if assigned(SQLite3Conn) then SQLite3Conn.Free;  if assigned(SQLTransaction) then SQLTransaction.Free;   inherited Destroy;end; end. The class where the create goes wrong has: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses ..., SQliteConnection; type  { TOraConmaintain }  TOraConmaintain = class(TSQliteConnection)   ...public  //constructor Create; overload;  constructor Create(ConnectionName, Password, SchemaName, DatabaseName : String);   overload;          ... constructor TOraConmaintain.Create(ConnectionName, Password, SchemaName,  DatabaseName: String); begin  inherited;  --> Goes wrong:  oracleconnectionmaintain.pas(107,12) Error: Wrong number of parameters specified for call to "Create"   OraConnectionName := ConnectionName;  OraSchemaName := SchemaName;  OraPassword := Password;  OraDatabaseName := DatabaseName;end;      When i remove "inherited;" then the program compiles but goes wrong when i execute it. I think that is because the create in the base class is not executed. Is it not possible to use overload on a create with parameters? ---------------------------------------------------------------------- Bart · 2021-08-02 08:50 Does this work in the overloaded constructor? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   inherited Create;  ... Bart ---------------------------------------------------------------------- lucamar · 2021-08-02 08:57 When you use only "inherited" it will look for a method with the same signature than the current one, which in this case doesn't exists. Instead it finds the original Create and tries to see if it can be called with the parameters of the current one, which it can't; hence the error. Specifying which inherited method you want, as Bart showed, circumvents this and calls the exact method you want. ---------------------------------------------------------------------- Hansvb · 2021-08-02 09:03 QuoteWhen you use only "inherited" it will look for a method with the same signature than the current one, which in this case doesn't exists. Instead it finds the original Create and tries to see if it can be called with the parameters of the current one, which it can't; hence the error. I saw this just after posting my question. In the message window i saw an other error which pointed to the create function of my base class. Good to know. Adding Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i inherited Create; This does the trick. No errors when compiling and no errors when executing. Thanks!