Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Ohmikus ellenállást megvalósitó osztály megvalósítása
- */
- /*Itt kell megvalósítani a resistor.h-ban deklarált
- nem inline függvényeket.
- A Jportára ezt a fajlt kell feltölteni.*/
- #include <iostream>
- #include "resistor.h"
- double Resistor::defR=30;
- Resistor::Resistor(){
- R=defR;}
- Resistor::Resistor(double r){
- R=r;
- }
- Resistor operator*(int n, const Resistor& r){
- return n*r.getR();}
- Resistor Resistor::operator+(const Resistor& r)const{
- return Resistor(R+r.R);
- }
- /*Resistor operator%(const Resistor& r) const{
- return Resistor((R*r.R)std::%(R+r.R));
- }*/
- Resistor Resistor::operator%(const Resistor& r) const{
- return 1/(1/R + 1/r.getR);
- }
- void Resistor::setDef(double r){
- defR=r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement