C
Chiller
I am in the process of writing a class that will represent metric distances
by accepting a value (ie, 3) and a unit of measure (ie, m).
I've written my constructor in the .h file as
Distance (int, char);
I've written the constructor in the .cpp implementation file as:
Distance :: Distance ( int n, char m) : nu(n), me(m) {}
When I try to enter a value in main using:
Distance a = Distance (5, m);
I get an error saying the value "m" is undeclared, yet the 5 is accepted.
Considering I declared these variables in the initial constructor I can't
understand why I'm getting this error.
I'd appreciate it if someone could give me an explanation of what I'm doing
wrong and how I can correct my mistake.
Thanks
by accepting a value (ie, 3) and a unit of measure (ie, m).
I've written my constructor in the .h file as
Distance (int, char);
I've written the constructor in the .cpp implementation file as:
Distance :: Distance ( int n, char m) : nu(n), me(m) {}
When I try to enter a value in main using:
Distance a = Distance (5, m);
I get an error saying the value "m" is undeclared, yet the 5 is accepted.
Considering I declared these variables in the initial constructor I can't
understand why I'm getting this error.
I'd appreciate it if someone could give me an explanation of what I'm doing
wrong and how I can correct my mistake.
Thanks