Welcome, Guest
Username: Password: Remember me
Discussions for CodeTyphon Object Pascal Programming Language
  • Page:
  • 1

TOPIC:

How to use generics in CT 5.5 9 years 5 days ago #8583

  • Md. Shariful Alam Khan
  • Md. Shariful Alam Khan's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 111
  • Thank you received: 0
I am trying to use generics in CT 5.5. I tried to do as following:
function SearchFriend(ALoginName : String) : TList<TSearchFriend>;
TSearchFriend is a record

I am getting following error message:
Fatal: Syntax error, ";" expected but "<" found

Please Log in or Create an account to join the conversation.

How to use generics in CT 5.5 9 years 5 days ago #8584

  • Konstantinos Papadoulas
  • Konstantinos Papadoulas's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 131
  • Thank you received: 19
Hi sir,

perhaps what you are trying to accomplish can be done by simply create a new class that inherits from TList and manages pointers of the TSearchFriend record.

Declaring a Generics type like this:
TMyList = specialize TFPGList<TSearchFriend>;
will not be as easy to implement as the above solution. You will need to specify an "=" Equal operator overload.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1