convert "class of" in pascal to D.

Eko Wahyudin eko.wahyudin at yahoo.co.id
Wed Jan 30 08:16:48 PST 2013


thanks all,

I think i am understand, if the closest solution is template,
there is no solution in D for my code like this.

type
       TMyObjectClass = class of TMyObjectA;

var
       ClassArray : array of TMyObjectClass; //the content
initialized
randomly
       ObjectArray : array of TMyObjectA;
       i, j : Integer;

procedure CreateAllObject;
begin
       J:= length(ClassArray);
       for I:= 0 to J do begin
         ObjectArray[I]:= ClassArray[I].Create({some argument});
       end;
end;

if D unable to do this, I think we must do something with D.

I'm still thinking, why constructor in D adopt C++ style rather
than pascal style, while pascal style is better :-?


More information about the Digitalmars-d mailing list