What is the difference between a constructor and a procedure in Delphi records?
        Posted  
        
            by HMcG
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by HMcG
        
        
        
        Published on 2010-03-22T19:46:10Z
        Indexed on 
            2010/03/22
            20:21 UTC
        
        
        Read the original article
        Hit count: 340
        
Is there difference in behavior between a constructor call and a procedure call in Delphi records? I have a D2010 code sample I want to convert to D2009 (which I am using). The sample uses a parameterless constructor, which is not permitted in Delphi 2009. If I substitute a simple parameterless procedure call, is there any functional difference for records?
I.E.
  TVector = record
  private
    FImpl: IVector;
  public
    constructor  Create;    // not allowed in D2009
  end;
becomes
  TVector = record
  private
    FImpl: IVector;
  public
    procedure  Create;    // so change to procedure
  end;
As far as I can see this should work, but I may be missing something.
© Stack Overflow or respective owner