00001 class Wheel; 00002 class Engine; 00003 class Body; 00004 class Car; 00005 00006 // interface to all car 'parts' 00007 struct CarElementVisitor 00008 { 00009 virtual void visit(Wheel& wheel) const = 0; 00010 virtual void visit(Engine& engine) const = 0; 00011 virtual void visit(Body& body) const = 0; 00012 00013 virtual void visitCar(Car& car) const = 0; 00014 virtual ~CarElementVisitor() {} 00015 }; 00016