public void accept(CarElementVisitor visitor) { foreach (CarElement element in _elements) { element.accept(visitor); } }
public void accept(CarElementVisitor visitor) { foreach (var element in this.getElements()) { element.accept(visitor); } visitor.visit(this); }
public void accept(CarElementVisitor visitor) { foreach (CarElement elem in elements) { elem.accept(visitor); } visitor.visit(this); }
public void accept(CarElementVisitor visitor) { /* * accept(CarElementVisitor) in Wheel implements * accept(CarElementVisitor) in CarElement, so the call * to accept is bound at run time. This can be considered * the *first* dispatch. However, the decision to call * visit(Wheel) (as opposed to visit(Engine) etc.) can be * made during compile time since 'this' is known at compile * time to be a Wheel. Moreover, each implementation of * CarElementVisitor implements the visit(Wheel), which is * another decision that is made at run time. This can be * considered the *second* dispatch. */ visitor.visit(this); }
public void accept(CarElementVisitor visitor) { visitor.visit(this); }