Witam,
Takie pytanie jak można się dostać wzajemnie do obiektów dwóch klas, żeby jedna mogla pracowac na drugich i odwrotnie jak w ponizszym przykladzie, bo pokazuje blad ' use of undefined type Jej'
#include <iostream>
#include <string>
using namespace std;
class Jej;
class Aba
{
int x, y;
public:
Aba(int x, int y)
{
this->x = x;
this->y = y;
}
void func(Jej q)
{
q.w = 10;
}
friend class Jej;
};
class Jej
{
int w, z;
public:
Jej(int w, int z)
{
this->w = w;
this->z = z;
}
void func2(Aba r)
{
r.x = 15;
}
friend class Aba;
};
int main()
{
Aba a(1, 1);
Jej q(1, 1);
system("pause");
}