In Delphi, What is the difference between Constructor and Class function to instantiate an object?
TPersonnel = class(TPersistent)
public
class function Create: TPersonnel; overload;
constructor Create(APersonelID: integer); overload;
end;
class function TPersonnel.Create: TPersonnel;
begin
result := inherited Create;
end;
constructor TPersonnel.Create(APersonelID: integer);
begin
inherited Create;
end;
I Know that class function Create will hide default constructor.
Regardless constructor Create parameter
Is there a reason that I should use the constructor?