The reason you cannot call VerifyID's from coGeneric is that the compiler sees coGeneric as a TPersistentClass which does not implement the VerifyIDs method. The following changes will give you the desired result...
type TCoreObjectClass = class of TCoreObject; If (coGeneric<>nil) and coGeneric.InheritsFrom(TCoreObject) then TCoreObjectClass(coGeneric).VerifyIDs(Module); Regards Andrew. On 17 Oct 10, at 06:38 , Andrew Brunner wrote: > 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? > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal