A
AMT2K5
If I have the class
class IOLabel : public IOField
{
private:
int len;
char format[11];
public:
IOLabel(int row, int col, int len):IOField(row, col)
{
this->len = len;
char *str = (char *)malloc(sizeof(len) + 1);
strcpy(str,'\0');
data = &str;
}
IOLabel(const char *str, int row, int col):IOField(row,col)
{
this->len = (int)(strlen(str) + 1);
char *temp = (char *)malloc(sizeof(len) + 1);
strcpy(temp,str);
data = &temp;
}
~IOLabel(){} //Deallocating non members?
};
How I de-allocate str and temp?
I love being a newbie
class IOLabel : public IOField
{
private:
int len;
char format[11];
public:
IOLabel(int row, int col, int len):IOField(row, col)
{
this->len = len;
char *str = (char *)malloc(sizeof(len) + 1);
strcpy(str,'\0');
data = &str;
}
IOLabel(const char *str, int row, int col):IOField(row,col)
{
this->len = (int)(strlen(str) + 1);
char *temp = (char *)malloc(sizeof(len) + 1);
strcpy(temp,str);
data = &temp;
}
~IOLabel(){} //Deallocating non members?
};
How I de-allocate str and temp?
I love being a newbie