Each of the following class declarations has errors. Locate as many as you can.
A) class Box
{
private:
double width;
double length;
double height;
public:
Box(double w, l, h)
{ width = w; length = l; height = h; }
Box(Box b) // Copy constructor
{ width = b.width;
length = b.length;
height = b.height; }
... Other member functions follow ...
};
B) class Circle
{
private:
double diameter;
int centerX;
int centerY;
public:
Circle(double d, int x, int y)
{ diameter = d; centerX = x; centerY = y; }
// Overloaded = operator
void Circle=(Circle &right)
{ diameter = right.diameter;
centerX = right.centerX;
centerY = right.centerY; }
... Other member functions follow ...
};
C) class Point
{
private:
int xCoord;
int yCoord;
public:
Point (int x, int y)
{ xCoord = x; yCoord = y; }
// Overloaded + operator
void operator+(const &Point Right)
{ xCoord += right.xCoord;
yCoord += right.yCoord;
}
... Other member functions follow ...
};
D) class Box
{
private:
double width;
double length;
double height;
public:
Box(double w, l, h)
{ width = w; length = l; height = h; }
// Overloaded prefix ++ operator
void operator++()
{ ++width; ++length; }
// Overloaded postfix ++ operator
void operator++()
{width++; length++; }
... Other member functions follow ...
};
E) class Yard
{
private:
double length;
public:
Yard(double l)
{ length = l; }
// double conversion function
void operator double()
{ return length; }
... Other member functions follow ...
};