c++ - How to make use of structure in another class? -
okay hello guys, have problem current assignment
i have 2 classes, namely employee class, , gm class.
in employee class, there structure used, namely
struct einfo { char username [80]; char password [80]; int eid; };
however, in gm class, have functions rely on struct in employee class. example,
void addemployee(fstream&, int, einfo&); void delemployee(fstream&, int, einfo&); void editemployee(fstream&, int, einfo&);
how suppose make use of that?
what have tried redeclaring
struct einfo { char username [80]; char password [80]; int eid; };
inside gm class. not work well. no syntax error, when im using
fstream afile; afile.open("employeeinfo.dat", ios::in | ios::out | ios::binary);
the file turns out empty itself.
any idea how fix ??
if struct einfo
declared inside employe
should refer employe::einfo
when outside employe
. if redeclare inside gm
compiler consider employe::einfo
, gm::einfo
2 different classes.
Comments
Post a Comment