There's a couple of problems with this. Firstly, exactly what laserlight said - the variables in the class are declared as private - this means that only member functions of the class or friend functions can access them. 'load' is not a member function or friend function, so that's where the error comes from. To fix it you would probably do something like this:
Code:
class spell
{
public:
spell();
~spell();
void load (parameters); // this is how to declare a member function
// or use
void friend load (parameters) // this is declaring the global function as a friend
private:
string name;
int damage;
//catagories
bool fire;
// etc.
};
// Then you'd do this
void spell::load(parameters) // if using the member method
{
// Code
}
// or
void load (parameters) // if using the friend approach
{
// Code
}
Secondly, I notice that you declare a number of instances of spells in 'load', which is perfectly allowed - it looks like you want to use the function to declare and setup all the variables. The problem is that it's probably a bit useless in your program because of scope - if you write a function and declare variables in it, that data can't be accessed from other functions unless you return a value from the function. What you can do is declare variables the calling function (eg if you are in main and are calling load, main is the calling function) and pass them by pointer/reference to load if using the friend approach, or just us the member function approach and call the method - much easier for this type of thing:
Code:
// headers and stuff
// Load is a member of spell
int main (void)
{
spell var1, var2; // etc;
// Code that determines the values to use (eg read in from user)
var1.load(values);
var2.load(values); // etc
return 0;
}
This is essentially the same idea as using a constructor - in fact a constructor is the preferred method for this since declaration and initialisation occur in a nice single statement.
Lasty, you probably don't need to use inline...