I have a c++ problem where I need to move my derived class's functions to the base class to "clean up" my code. This is the code that I want to move:
double Resistor::getVolt() { if (connection_a->getCharge() > connection_b->getCharge()) return connection_a->getCharge() - connection_b->getCharge(); else return connection_b->getCharge() - connection_a->getCharge(); } double Resistor::getCurr() { if (connection_a->getCharge() > connection_b->getCharge()) return (connection_a->getCharge() - connection_b->getCharge())/resistance; else return (connection_b->getCharge() - connection_a->getCharge())/resistance; } I need to move all this and still reach the variables connection_a & connection_b without making the private.