#include #include "Resistor.h" #include "Capacitor.h" #include "Inductor.h" #include "ShowVisitor.h" void ShowVisitor::visit(Resistor& resistor) { std::cout << "resistor" << std::endl; std::cout << " value " << resistor.getValue() << std::endl; std::cout << " tolerance " << resistor.getTolerance() << std::endl; } void ShowVisitor::visit(Capacitor& capacitor) { std::cout << "capacitor" << std::endl; std::cout << " value " << capacitor.getValue() << std::endl; std::cout << " electrolitic " << (capacitor.isElectrolitic() ? "yes" : "no") << std::endl; } void ShowVisitor::visit(Inductor& inductor) { std::cout << "inductor" << std::endl; std::cout << " value " << inductor.getValue() << std::endl; std::cout << " saturable " << ( inductor.isSaturable() ? "yes" : "no" ) << std::endl; }