**STUPID** newbie question...
Hi!
Can anyone plz tell me why the following code does not work?
Code:
class Class2;
class Class1
{
friend void Class2::func2();
private:
void func1(){}
};
class Class2
{
public:
void func2(){}
};
I get an error message saying that Class2::func2() is not a member of Class2..!!!???
thanx
Still don't get it... (no answer so far...)
Yes, I am sure that would work. However, there is more...
Take a look at the code below:
Code:
class Class2;
class Class1
{
friend void Class2::func2();
private:
void func1(){}
};
class Class2
{
public:
void func2();
};
void Class2::func2()
{
Class1 c1;
c1.func1();
}
I get the same error as before, Class1 can't find the function in Class2. How can I solve this??
If I can't, how can I have two classes access each others members?