- #1
lewis198
- 96
- 0
Hi guys, I was wondering if you could help me with the following:
1.I declare a class, then put public members into it.
2.Then I make member functions that return values that are computed from the values of other members. These functions would have no input, I guess, so I gave them none. I can actually compile up to this point.
3.Then I went onto the main part of the program, int main, and defined a class, and gave the members that are part of the other member functions values. I thought this would then give me a function that I could print values off, but when I tried to, the error message was:
'invalid use of member. Did you forget the '&'?'
The file looks like this:
class name
{
member 1
member 2
member n
member_function()
{}
}
int main()
{
class name x;
member1=value;
member2=value;
member3=value;
printf("%d",x.member_function);
}
Thanks for your time.
1.I declare a class, then put public members into it.
2.Then I make member functions that return values that are computed from the values of other members. These functions would have no input, I guess, so I gave them none. I can actually compile up to this point.
3.Then I went onto the main part of the program, int main, and defined a class, and gave the members that are part of the other member functions values. I thought this would then give me a function that I could print values off, but when I tried to, the error message was:
'invalid use of member. Did you forget the '&'?'
The file looks like this:
class name
{
member 1
member 2
member n
member_function()
{}
}
int main()
{
class name x;
member1=value;
member2=value;
member3=value;
printf("%d",x.member_function);
}
Thanks for your time.