Question: If I have two overloaded constructors, one without and one with parameters:

```
constructor Create; overload;
constructor Create(Param: TObject); overload;

```

If I want the code in the first one to run, does it make sense to call it within the second one? And inherited to call the parent constructor first as well?

```
constructor TMyType.Create(Param: TObject);
begin
  inherited Create;
  Create;
  FParam := Param;
end;

```

Thanks!

Answer: 
> 
> If I want the code in the first one to run, does it make sense to call it within the second one **And** inherited to call the parent constructor first as well?
> 
> 
> 

No. Because your 1st constructor should call inherited one itself, so in the end the inherited constructor would get called twice, which it most probably does not expect. 

Otherwise, if your parameterless `TMyType.Create()` does not call inherited one, then it is hardly a proper constructor and should be just removed. 

So the correct approach would be like that:

```
constructor TMyType.Create(Param: TObject); overload;
begin
  Create();
  FParam := Param;
end;

constructor TMyType.Create();  overload;
begin
  inherited Create(); // for both constructors

  ...some common code
end;

```

However in Delphi there is yet another possibility.

```
constructor Create; overload;
constructor Create(Param: TObject); overload;
procedure AfterConstruction; override;

constructor TMyType.Create(Param: TObject); 
begin
  inherited Create(); 

  FParam := Param;
end;

constructor TMyType.Create();
begin
  inherited ; 

 ... maybe some extra code
end;

procedure TMyType.AfterConstruction();
begin
    inherited;

  ...some common code
end;

```

Note the difference though, when would "common code" be executed and when would do "FParam := Param;"

In the 1st way, the flow would be like 

* Create (Param)
* ..Create()
* ....Inherited Create()
* ....**Common Code**
* ..**FParam := Param;**
* *AfterConstruction (empty)*

In the second the sequence would be different

* Create(Param) or Create()
* ..Inherited Create()
* ..**FParam := Param;**
* AfterConstruction
* ..**Common Code**

As you can see the order of those chunks being executed got reversed.

---

However maybe you don't need multiple constructors at all? 

```
constructor TMyType.Create(const Param: TObject = nil); 
begin
  inherited; 

 ... Some code

  FParam := Param;
end;

```
**Yes your code makes perfect sense and the constructor's calls do exactly what one should expect.**

Delphi object model supports both constructors that call inherited constructors and constructors that do not call inherited ones.

If you are not sure try this:

```
program Project5;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TMyBase = class
    constructor Create;
  end;

  TMyType = class(TMyBase)
    constructor Create; overload;
    constructor Create(Param: TObject); overload;
  end;

constructor TMyBase.Create;
begin
  Writeln('TMyBase.Create');
end;

constructor TMyType.Create;
begin
  Writeln('TMyType.Create');
end;

constructor TMyType.Create(Param: TObject);
begin
  inherited Create;
  Create;
  Writeln('TMyType.Create(Param)');
end;

begin
  TMyType.Create(TObject.Create);
  Readln;
end.

```