Answer the question
In order to leave comments, you need to log in
Does the "visitor" pattern violate the OCP principle?
There is an interface:
interface Visitor:
visitA(a: A)
visitB(b: B)
visitC(c: C)
class SlowVisitor:
visitA(a: A)
visitB(b: B)
visitC(c: C)
class FastVisitor:
visitA(a: A)
visitB(b: B)
visitC(c: C)
interface Visitor:
visitA(a: A)
visitB(b: B)
visitC(c: C)
visitD(d: D)
Answer the question
In order to leave comments, you need to log in
Patterns are not dogma, like all principles. You weigh the pros and cons and choose a solution. It's like cutting off a leg in surgery is bad, but if it's gangrene, then it's necessary.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question