++ . - , , ++ , Delphi .
++ Builder Delphi. ++ __classid() __typeinfo() Delphi- TMetaClass* , TObject. Delphi ( Delphi.pas ++ Builder).
TApplication::CreateForm() Delphi TMetaClass* ++ ( , , TComponent, TApplication Owner), :
TForm *f;
Application->CreateForm(__classid(TForm), &f);
f->ShowModal();
delete f;
Delphi, :
unit CreateAFormUnit;
interface
uses
Classes, Forms;
function CreateAForm(AClass: TFormClass; AOwner: TComponent): TForm;
implementation
function CreateAForm(AClass: TFormClass; AOwner: TComponent): TForm;
begin
Result := AClass.Create(AOwner);
end;
end.
#include "CreateAFormUnit.hpp"
TForm *f = CreateAForm(__classid(TForm), SomeOwner);
f->ShowModal();
delete f;