I need help on how to have access to my variables when inside of the ex_class.add() function.
struct ex_struct
{
char name[21];
int num;
....
};
class ex_class
{
public:
ex_class();
int display_all();
int add(const ex_struct &);
private:
ex_struct new_struct[101];
int keep_count;
};
ex_class::ex_class()
{
keep_count=0;
...
}
#### below is where i am not sure on what to do??
int ex_class::add(const ex_struct &)
{
// How would i have access to something declared in main
}
int main()
{
ex_class my_fav[101];
ex_class my_nightmare[101];
....
//eventually calling
my_nightmare.add(?????);
}
Any help would be greatly appreciated, think i should have taken better notes in class.
Thanks in advance.
jd1pek
struct ex_struct
{
char name[21];
int num;
....
};
class ex_class
{
public:
ex_class();
int display_all();
int add(const ex_struct &);
private:
ex_struct new_struct[101];
int keep_count;
};
ex_class::ex_class()
{
keep_count=0;
...
}
#### below is where i am not sure on what to do??
int ex_class::add(const ex_struct &)
{
// How would i have access to something declared in main
}
int main()
{
ex_class my_fav[101];
ex_class my_nightmare[101];
....
//eventually calling
my_nightmare.add(?????);
}
Any help would be greatly appreciated, think i should have taken better notes in class.
Thanks in advance.
jd1pek