I'm trying to write a class for my program. It keeps telling me that 'constructors aren't allowed return types". I know this, and my constructor doesnt return anything. What am I doing wrong? I did it EXACTLY how the book said to. Here's the class definition:
class ctl_button{
public:
int x;
int y;
int width;
int height;
char caption [100];
bool enabled;
long action;
COLORREF backColor;
COLORREF foreColor;
ctl_button();
draw(HDC hdc);
}
ctl_button::ctl_button(){
x = 0;
y = 0;
width = 0;
height = 0;
enabled = 1;
action = NULL;
}
ctl_button::draw(HDC hdc){
HPEN pen = CreatePen(PS_SOLID, 1, RGB(100, 100, 100));
SelectObject(hdc, pen);
Rectangle(hdc, x, y, x + width, x + height);
}
By the way, is there a way to have a char array that has no set dimensions? The caption property I kind of would like to be able to set it to any string I want....C++ makes this very hard.
class ctl_button{
public:
int x;
int y;
int width;
int height;
char caption [100];
bool enabled;
long action;
COLORREF backColor;
COLORREF foreColor;
ctl_button();
draw(HDC hdc);
}
ctl_button::ctl_button(){
x = 0;
y = 0;
width = 0;
height = 0;
enabled = 1;
action = NULL;
}
ctl_button::draw(HDC hdc){
HPEN pen = CreatePen(PS_SOLID, 1, RGB(100, 100, 100));
SelectObject(hdc, pen);
Rectangle(hdc, x, y, x + width, x + height);
}
By the way, is there a way to have a char array that has no set dimensions? The caption property I kind of would like to be able to set it to any string I want....C++ makes this very hard.