Should be fairly simple but I want to get it right before I start coding. Let's say I coded a CustomLayout or CustomListView class that has a special behaviour on the elements it contains (eg highlighting when hovering above an element on a touchscreen).
I then want this CustomListView to be able to display different types of elements, for instance a Place, a Bookmark or a SearchResult. When displaying a Place it should display only the name, when displaying a Bookmark, it should display the name plus a time stamp for instance.
I know the wrong way to do this, i.e. in the CustomListView do something like
if (anInstance instanceof Bookmark)
What would be the best way to design my classes?