I'm making a RoomDimension class that uses a FeetInches class, but whenever I use FeetInches inside of RoomDimension, I get an avalanche of error messages, including:
error C2146: syntax error : missing ';' before identifier 'length'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Here are the classes:
class FeetInches
{
private:
int feet; // To hold a number of feet
int inches; // To hold a number of inches
public:
// Constructor
FeetInches(int f = 0, int i = 0)
{ feet = f;
inches = i; }
// Mutator functions
void setFeet(int f)
{ feet = f; }
void setInches(int i)
{ inches = i; }
// Accessor functions
int getFeet() const
{ return feet; }
int getInches() const
{ return inches; }
};
class RoomDimension
{
private:
FeetInches length;
FeetInches width;
public:
// constructors
RoomDimension(void);
// getter functions
FeetInches getLength(void) const
{ return length; }
FeetInches getWidth(void) const
{ return width; }
// setter functions
void setLength(FeetInches l)
{ length = l; }
void setWidth(FeetInches w)
{ width = w; }
};
What am I doing wrong?
I didn't see any problem except that the constructor of RoomDimension is not implemented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With