Hi guys. Im getting started with my program and am getting error on my set up of the classes. Not sure why i think im doing them right. line 13, 17, 21 say control reaches end of non void function. line 27, 43 says base class polygon has a flexible array member.
class polygon
{
public:
polygon(int numSides = 0);//+ Polyon(numSides:int) default is 0
//{+ set(sideNum: int, value:int) : void, ensures no negative side values
void set(){
int sideNum =0;
int value=0;
}
//+ get (sideNum:int):int, returns the value of sides[sideNum]
int get(int sideNum){
}
//+ perimeter(): int virtual returns the perimeter of the polygon
intvirtual perimeter(){
}
//+ area(): double virtual, returns the area of the polygon
doublevirtual area(){
}
private:
int numOfSides();
int side[];// listed in clockwise order , MAX sides is 100
};
class Rectangle : public polygon
{
public:
Rectangle();//class polygon(4)
doublevirtual area();//appropriatley... from polygon class
int perimeter();// appropriatley.... from polygon class
};
class Square : public Rectangle
{
public:
Square();//appropriately
doublevirtual area();//appropriately
intvirtual perimeter();//appropriately
};
class RightTri : public polygon
{
public:
RightTri();//class polygon(3)
doublevirtual area(); // appropriately
intvirtual perimeter();// appropriately
};
class RectSolid : public Rectangle
{
public:
int volume();//return the volume... may not be int
private:
int height;
};
I am no sure but I doubt your line 24; from my knowledge static array size shouldn't change and should be provided on intialization but then again there are a number of more friendly options available