passing a struct to a class
I was wondering if it could be done... I thought I read somewhere that it could, but I don't remember... these were the only guidelines that I found:
Quote:
Containers can hold standard objects as well as custom objects, as long as the objects in the container meet a few requirements:
- The object must have a default constructor,
- an accessible destructor, and
- an accessible assignment operator.
if it can, how? what I'm trying to do is something like this:
Code:
/* MAIN.CPP */
...
int main()
{
...
struct player
{
int atk,def,hp;
};
player p1
loginClass login;
login.init(p1);
...
}
the loginClass class is in a different file and gets linked... what I want it (login.init) to do is just open up a file and fill in the struct from that file... I don't really have any real code written yet, I just need to know how to write it...