[Lazarus] How to cast a Interface to a Object in Lazaeus
Michael Van Canneyt
michael at freepascal.org
Fri Mar 13 10:32:50 CET 2015
On Fri, 13 Mar 2015, aradeonas wrote:
> Excuse me Michael,
> I didn't know what top-posting mean until now.(Why is it impolite,I ask because really I don't know and thank you for mention it).
Forums are used for conversations.
People sometimes must jump in the conversation without reading the whole thread.
Sometimes multiple questions are asked in a single post.
Top posting destroys the logic of the conversation:
It requires you to jump forwards and backwards in the mail.
This is especially so if there are multiple questions in the mail.
With inline replies, you can read through the mail and see the questions
and their answer logically grouped together.
> About question:
> What you suggest for this need:
> We have types of file that have some shared properties like name and size but have more like Music artist or video width and we want to add them in a list like playlist.
> What is the best way to do this?
It seems like a simple case, so:
Simply define 1 class that has all properties you are interested in, and a 'FileType : TMyFileType' property
where TMyFileType = (ftNormal,ftAudio,ftVideo)
and define a TObjectList descendent (or use a generic list or collection) using this object.
I don't see the need to use interfaces in this case, unless you need additional features which you did not describe.
More information about the Lazarus