LLD - Behavioral Design Patterns — Part 2
What will be the output of the following code?
class ElementC {
accept(visitor) {
visitor.visitElementC(this);
}
}
class Visitor {
visitElementC(element) {
console.log('ElementC visited');
}
}
const element = new ElementC();
const visitor = new Visitor();
element.accept(visitor);