[fpc-pascal] Problem accessing Class Method with abstraction

Andrew Brunner andrew.t.brunner at gmail.com
Sun Oct 17 15:38:34 CEST 2010


procedure VerifyIDs(Var Module:TDBMSModule);
var
  iLcv:integer;
  ItemP:PCoreObjectItem;
  coGeneric:TPersistentClass;
  coItem:TCoreObject;
begin
  for iLcv:=0 to High(CoreObjectItems) do begin
    ItemP:=CoreObjectItems[iLcv];
    coGeneric:=GetClass(ItemP^.ClassName);
    if (coGeneric<>nil) and coGeneric.InheritsFrom(TCoreObject) then begin
      coItem:=coGeneric.Create as TCoreObject;
      Try
        coItem.VerifyIDs(Module);
      finally
        FreeAndNil(coItem);
      end;
    end;
  end;
end;

This code works as expected but why do I need to create an instance of
the object if I just want to reference it's class procedure of
VerifyIDs?



More information about the fpc-pascal mailing list