jeudi 3 avril 2014

Visitor Pattern with VB.Net


Vote count:

0




Let's say I have a visitor interface like this:



''' <remarks>Visitor Pattern</remarks>
Public Interface IVisitor
Sub Visit(value As Type1)
Sub Visit(value As Type2)
Sub Visit(value As Type3)
Sub Visit(value As Type4)
Sub Visit(value As ...)
...
End Interface


Is there a way for my concrete visitors to avoid implementing Visit functions they don't need? I'd like to avoid doing stuff like this in my concrete visitors:



#Region "Methods not implemented (not needed)"

Public Sub Visit(value As Type4) Implements IVisitor.Visit

End Sub

...


I know that I can't use the Overridable keyword in Interface. So maybe I should just drop Interface for Overridable Sub in my base class?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire