Does Delphi really handle dynamic classes better than static?

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-10T09:40:06Z Indexed on 2010/04/10 9:43 UTC
Read the original article Hit count: 332

Hello,

I was told more than once that Delphi handles dynamic classes better than static.Thereby using the following:

type Tsomeclass=class(TObject)
  private procedure proc1;
  public 
    someint:integer;
    procedure proc2;
end;

var someclass:TSomeclass;

implementation

...

initialization
  someclass:=TSomeclass.Create;
finalization
  someclass.Free;

rather than

type Tsomeclass=class
  private class procedure proc1;
  public 
    var someint:integer;
    class procedure proc2;
end;

90% of the classes in the project I'm working on have and need only one instance.Do I really have to use the first way for using those classes? Is it better optimized,handled by Delphi?

Sorry,I have no arguments to backup this hypothesis,but I want an expert's opinion.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about delphi

Related posts about delphi-2009