I would reallly appreciate some help with this. The actual code is different, but the setup is the same...
I have created two classes:
Class1, Class2
each in separate header files.
i've created #ifndef declarations for both and included the header files of each class.
for some reason, the "friend" declaration doesn't want to let me access any member functions of the other class:
I've also prototyped each class in the other class definition.
Class1.h excerpt:
I have created two classes:
Class1, Class2
each in separate header files.
i've created #ifndef declarations for both and included the header files of each class.
for some reason, the "friend" declaration doesn't want to let me access any member functions of the other class:
I've also prototyped each class in the other class definition.
Class1.h excerpt:
Code:
friend class Class2;
void dosomething();[\code]
...
[code]Class1::dosomething(){
cout<<"made it!\n";
}[\code]
Class2.h excerpt:
[code]friend class Class1;
void accessfunction();[\code]
...
[code]Class2::accessfunction(){
dosomething(); // does not work... say's "undefined identifier 'dosomething'"
}[\code]
I'd really appreciate some help... this is simplified from my real code by I believe it's the same situation...
Am I missing what a "friend" does? is there something else I need to do to get it to recognize the member function?
thanks!