Jump to content
dmitrybv

Is it possible to declare an identical type for a generic class?

Recommended Posts

Is it possible to declare an identical type for a generic class?


I can't do it.

 

 

  TTypedListFieldLinkEh = EhLib.TableLink.TypedLists.TTypedListFieldLinkEh;
  TListFieldLinkListEh = EhLib.TableLink.TypedLists.TListFieldLinkListEh;
  TTypedListItemLinkEh = EhLib.TableLink.TypedLists.TTypedListItemLinkEh;
  TListRecLinkListEh = EhLib.TableLink.TypedLists.TListRecLinkListEh;
  TListTableLinkEh = EhLib.TableLink.TypedLists.TListTableLinkEh;
  TListFieldLinkListEh<T: class, constructor> = EhLib.TableLink.TypedLists.TListFieldLinkListEh<T: class, constructor>; //Compile Error
  TTypedListItemLinkEh<T: class, constructor> = EhLib.TableLink.TypedLists.TTypedListItemLinkEh<T: class, constructor>;
  TListRecLinkListEh<T: class, constructor> = EhLib.TableLink.TypedLists.TListRecLinkListEh<T: class, constructor>;
  TListTableLinkEh<T: class, constructor> = EhLib.TableLink.TypedLists.TListTableLinkEh<T: class, constructor>;

 

image.thumb.png.c2c9c03086efca79e8c50f65be0118e5.png

Share this post


Link to post

Thank you. This code works:
 

TListFieldLinkListEh<T: class, constructor> = class(EhLib.TableLink.TypedLists.TListFieldLinkListEh<T>);
TTypedListItemLinkEh<T: class, constructor> = class(EhLib.TableLink.TypedLists.TTypedListItemLinkEh<T>);
TListRecLinkListEh<T: class, constructor> = class(EhLib.TableLink.TypedLists.TListRecLinkListEh<T>);
TListTableLinkEh<T: class, constructor> = class(EhLib.TableLink.TypedLists.TListTableLinkEh<T>);

In this case, however, a new type is created. But for types created through generics this is not a very big problem.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×