I created a class in C++ called Commands (file name commands.cpp).
我已经这样做,把它放入指挥阵列(档案名称测试。
我要知道的是,如何称呼指挥阶层内部的职能。
for example I have a function within the Commands class called
void command::init(char data[])
{
//detail
}
以及我试图做些什么来称职
EDIT
Class test{
int CmdCount; // number of commands in the array
int MaxCmds; // max amount of commands allowed
command* cmds;
Public:
int get_command_count() const{
return CmdCount;
}
int readfile(const char fname[]){
char line[161];
FILE* fp;
fp = fopen(fname, "r");
if(fp){
for(int i = 0; 1 == fscanf(fp, "%160[^
]
", line; i++){
cmds[get_command_count()].init(line);
CmdCount += 1;
}
}
fclose(fp);
}
};
I just want to know how to be able to call void command::init(char data[]).
Any suggestions?
thanks.