Arrays

Pages: 12
What does this /*in*/ means in class constructor?
Can you give an example? /*is a multiline comment*/
I got it now L B, thank you.
I need help with the following:

Write a class called Thermometer. The thermometer should have the following features:
• Return the current temperature in either C or F (conversion)
• Reset the temperature to zero (if the current scale is C) or 32 (if the current scale is F)
• Set the scale of the thermometer to either C or F
• Set the temperature
• Return the current scale
• Provide a copy constructor to make a copy of a Thermometer
All data members of your class should be private. You should include a constructor to initialize the Thermometer object to 0˚ C, as well as a constructor that accepts a temperature and scale to initialize to. You will also need a copy constructor.



include "ClassCons2.h"
#include <iostream>
using namespace std;

class ThermoClass {
private:
char C;
char F;
float temp;
ThermoClass();
SetTemp(float atemp);
SetTheScale(char C, F);
GetTemp();
Scale = 'C';

};

int main ()
{
ThermoClass::Thermoclass (float) {return afloat};
ThermoClass thermoObject;
thermoObject.SetTheScale;
return Scale;


}


THIS IS WHAT I'VE DONE SO FAR. I NEED TO KNOW IF I'M ON THE RIGHT TRACK.
You're close, but it looks like you have no understanding of classes. Try reading this:
http://www.cplusplus.com/doc/tutorial/classes/
What is the difference between these two: track& and &track.
Can you post the code they were in? If they were by themselves like that, then the first is a type which is a reference to an object of type track, and the second is taking the address of an object (not type) named track. Please post the entire line of code surrounding the statements.
Topic archived. No new replies allowed.
Pages: 12