This is my Resistor.h file: #ifndef Resistor_h #define Resistor_h #include <stri
ID: 3527407 • Letter: T
Question
This is my Resistor.h file:
#ifndef Resistor_h
#define Resistor_h
#include <string>
using namespace std;
class Resistor{
private:
double Nom;
double Tol;
string Name;
public:
Resistor(double res, double tol, string N, bool c);
~Resistor(); //Destructor
void setNom(double Nom, bool fncheck);//memebers
void setTol(double Tol, bool fncheck);
void setName(string Nm, bool fncheck);
double getTol(bool fncheck);
double getNom(bool fncheck);
string getName(bool fncheck);
};
#endif
This is my Resistor.cpp file:
#include "Resistor.h"
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
Resistor::Resistor(double nom, double tol, string N, bool c)
{
Nom = nom;
Tol = Tol;
Name = N;
if(c){
cout<<"constructor was called"<<endl;
}
}
double setNom(double n, bool fncheck){
Nom=n;
if(fncheck){
cout<<"Set Nom was called"<<endl;
}
return Nom;
}
double setTol(double n, bool fncheck){
Tol=n;
if(fncheck){
cout<<"Set Tol was called"<<endl;
}
return Tol;
}
void setName(string Nm, bool fncheck){
Nm = Nm;
if(fncheck){
cout<<"Set Name was called"<<endl;
}
}
I am getting the following errors:
resistor.cpp(18): error C2065: 'Nom' : undeclared identifier
resistor.cpp(22): error C2065: 'Nom' : undeclared identifier
resistor.cpp(26): error C2065: 'Tol' : undeclared identifier
resistor.cpp(30): error C2065: 'Tol' : undeclared identifier
I do not understand where I am making my mistake. Could someone please clarify this for me?? Thankees!!
Explanation / Answer
Resistor::SomeMethodinClassResistorRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.