Guidance using classes in C++

I am trying to learn about how to use classes with private and public variables in c++. I've got a conversion program that I would like to use as a prop.

If I was to add a class to this program, what I think I know is...

(Just to say, this is still fresh and I don't have a full grasp of all the concepts yet)

I know that to start a class, you must first declare it like for example...

class Conversion
int inches;
int foot;

void conversion(int happen);

© SolutionLibrary Inc. 9836dcf9d7

Solution Preview


float Conversion::getFoot(){
return foot;

void Conversion::setFoot(float ft){
foot = ft;

float Conversion::getCentimeters(){
return centimeters;
void Conversion::convert(){
//figure out how many feet and inches is centimeters

//To convert from Inches to Centimeter, simply multiply
// the Inches by 2.54
//To convert from Feet to Inches, simply multiply the
// Feet by 12
//To convert from Feet to Centimeters, simply multiply
// the Feet by 30.48

//begin throw,try and catch commands

float a, b;
//a try should just be the code that could have problems

a = inches*2.54f; //total number of centimeters in an inch
b = foot*30.48f; //total number of centimeters in a foot

//add the foot ...