Vote count:
0
Let's say that I have these two interfaces (PHP syntax)
interface Renderable_Item
{
}
interface Item_Renderer
{
function render(Renderable_Item $item);
}
I have a set of classes that are all same of a kind, but they just have nothing important (in Item_Renderer point of view) in common. All these classes implements Renderable_Item because they all should be renderable by Item_Renderer. So the Renderable_Item interface is just my way to group these classes.
Classes that implement Item_Renderer would have to first detect the concrete type, "downcast" it and then call methods of the concrete class anyway, so the interface has no meaning here, but in my opinion, it just "suits" there
Is there some better approach?
asked 1 min ago
OOP - blank interface
Aucun commentaire:
Enregistrer un commentaire