I'm trying to declare an object of type rectangle but it keeps showing me this error
this is the rectangle class which inherits from shape class:
class rectangle: public shape{
int width, height;
public:
rectangle();
void draw(int width, int height){
for(int i = 1; i <= height; i++){
for(int j = 1; j <= width; j++){
if( i == 1 && i == height)
cout<<"*";
else if( j == 1 && j == width)
cout<<"*";
else
cout<<" ";
}
cout<<endl;
}
}
};
this is the shape class:
class shape
{
int x, y;
char letter;
public:
shape(int x, int y, char letter, int length){
int X = x;
int Y = y;
int L = letter;
}
void verLine(){
for(int i = 0; i < 5; i++){
cout<<"*"<<endl;
}
}
void horLine(){
for(int i = 0; i < 5; i++){
cout<<"*";
}
}
char setLetter(char letter){
int newLetter = letter;
return newLetter;
}
void gotoxy(int x, int y){
HANDLE hConsole;
COORD cursorLoe;
std::cout.flush();
cursorLoe.X = x;
cursorLoe.Y = y;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsole, cursorLoe);
}
};
and this is the main:
int main()
{
rectangle r1;
cout<<endl;
r1.draw(5,5);
return 0;
}
I think the problem is with the default constructor I have in the rectangle class, but I din't find any other way to code it