|
-
May 17th, 1999, 02:30 AM
#1
How to initialize structures inside a class?
How do u initialize a structure inside a class e.g
class Mail
{
public:
struct VM{
char current[20];
char dtmf;
char next[20];
void (*ifptr)(int,int);
};
typedef VM VMail;
VMail Mailme[] = {
{ "qq", 'd', "ww", Function1},
{ "aa", 'w', "eee", Function2},
};
}
The compiler cannot recognize the initialization here. How do i put this part of the initialization code in the constructor?
VMail Mailme[] = {
{ "qq", 'd', "ww", Function1},
{ "aa", 'w', "eee", Function2},
};
I already tried putting it in the constructor but it still cannot work. How else can i initialize my structure?
Thanks
-
May 17th, 1999, 04:16 AM
#2
Re: How to initialize structures inside a class?
I do not know if this is the problem, but if I had to do this I would do it like this:
// Just declare globally
typedef struct VM{
char current[20];
char dtmf;
char next[20];
void (*ifptr)(int,int);
} VMail;
Class Mail
{
VMail mail[2];
};
void Mail::Mail()
{
mail[0].string = "Hello";
......
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|