[fpc-devel] How to force the child's constructor to call its parent constructor

amir amir at aavani.net
Sun Oct 21 21:41:05 CEST 2007


Is there any way to force the child constructor to call its 
parent(direct parent) constructor. Consider the following case:

  TParent= class (TObject)
  private
    ID: Integer;
  public
      constructor Create (MyIdentifier: Integer);
     ....
  end;

I want to force the all childs of TParent to call the Create constructor 
(with appropriate parameter). But one can implement a child class like this:
  constructor TChild.Create;
  begin
//     do any thing but not use inherited.
  end;





More information about the fpc-devel mailing list