Diode::Diode(Circuit& cir, Node* n1, Node* n2, string name)
: TwoEndedDevice(n1, n2, name)
{
	cir.addDevice(this);
	n1->base.push_back(this);
	n2->head.push_back(this);
}
Resistor::Resistor(Circuit& cir, double R, Node* n1, Node* n2, string name)
: TwoEndedDevice(n1, n2, name), R(R)
{
	cir.addDevice(this);
	n1->base.push_back(this);
	n2->head.push_back(this);
}
Inductor::Inductor(Circuit& cir, double H, Node* n1, Node* n2, string name)
: TwoEndedDevice(n1, n2, name), H(H)
{
	cir.addDevice(this);
	n1->base.push_back(this);
	n2->head.push_back(this);
}
Capacitor::Capacitor(Circuit& cir, double C, Node* n1, Node* n2, string name)
: TwoEndedDevice(n1, n2, name), C(C)
{
	cir.addDevice(this);
	n1->base.push_back(this);
	n2->head.push_back(this);
}
ExternalVoltage::ExternalVoltage(Circuit& cir, funct f, Node* n, string name)
: OneEndedDevice(n, name), f(f)
{
	cir.addDevice(this);
	n->base.push_back(this);
}