#include "PowerVisitor.h" #include "Light.h" #include "Pole.h" #include void PowerVisitor::visit(Light &l) { switch (l.get()) { case Light::ON: runningTotal += 60; break; case Light::FLASH: runningTotal += 30; break; } } void PowerVisitor::calculatePower(Pole &p) { runningTotal = 0; p.accept(*this); std::cout << "Power usage is " << runningTotal << " watts.\n"; }