954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Classes

biel_andrada
Newbie Poster
3 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Can you give us a hint as to where to look, what you are seeing, how you know it doesn't work? Does it compile? Run? Give unexpected results?

We might be able to help if we know what we're looking for.

Chainsaw
Posting Pro in Training
436 posts since Jun 2004
Reputation Points: 36
Solved Threads: 11
 

Well, here's an easy one--you've spelled a method two different ways (the first is correct):

... Temp Celsius( ); //needed to work on ... <

Also, it won't compile until you actually define a body for that method like you did forTemp::Fahrenheit.

Hm, also noticed you have both myDegree and myDegrees in your code; I bet you don't want that either.

Unless you've snipped out lots of code, it looks like you haven't actually implemented half of the class members... including the constructor that actually accepts an argument and (one would imagine) initializes myDegree. Without that, it'll always be zero.

And... this looks suspicious:

... cin>>theTemp; //input ...

There's no way for the compiler to know that you want a double-precision value to be read... you need adouble somewhere to hold the value.

That should get you started. --sg

gusano79
Posting Pro
521 posts since May 2004
Reputation Points: 182
Solved Threads: 77
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You