Am 26.02.2014 16:16, schrieb silvioprog:
Can I use this "metatype" in other class? E.g.:

  generic TMyGeneric<T> = class
  public type
    TMyGenericClass = class of TMyGeneric;
  end;

  TMyService = class
  public
class procedure RegisterItem(aItemClass: TMyGenericClass); // maybe "aItemClass: TMyGeneric.TMyGenericClass"?
  end;

You'd need something like "aItemClass: specialize TMyGeneric<SpecificType>.TMyGenericClass", but that might not compile in mode ObjFPC.

As an aside: if TMyGeneric would not be a generic you'd need TMyGeneric.TMyGenericClass as well, a TMyGenericClass is part of TMyGeneric's scope and TMyService does not know this scope.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to