i am new to this forum as i'm sure you can tell. i am having a problem with this class i wrote. i am geting this error:error C2601: 'add' : local function definitions are illegal. for each of the functions in my class that have to have an int to work.
Code:
//Declarations
class Narray
{
private:
int i;
int numels;
public:
struct arraydef
{
int el[10];
};
struct arraydef marray;
Narray();
int orig();
int full();
int empty();
int add(int); //i get an error here
int remove(int); //and here
int query(int); //and here also
//as well as in the main
};
i'll just post one of the funtions and hopefully all the problems are the same.
Code:
int Narray::add(int num)
{
if(full())
{
return -1;
}
for(i = 0; i < 10; i++)
{
if(marray.el[i] == -1)
{
marray.el[i] = num;
numels = numels + 1;
break;
}
}
return 0;
}
thanks for any help....