aboutsummaryrefslogtreecommitdiff
path: root/oop2w6/ShowVisitor.cpp
blob: f30b7019699b1099b7a1e41d698d8cee16520ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>

#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;
}