I have the following problem, according to the didactic example below:
#include "b.h"
#include "c.h"
class A
{
public:
int start();
private:
B b;
C c;
int x;
}
a.cpp
int A::start()
{
c = b.copy();
x = c.d;
return x;
}
#include "c.h"
class B
{
private:
C c;
public:
C copy();
}
b.cpp
C B::copy()
{
c.add(1);
return c;
}
class C
{
public:
void add(int x);
int d;
}
c.cpp
void c.add(int x)
{
C::d = x + 10;
return;
}
main()
{
A a;
int y;
y = a.start();
cout << y ;
}
/ strong> this does not exist anymore.
How can I get around this situation, knowing that I have to return to the A class the modified object of the C and that the only function in the C class must be void.
It would already help a way to read the variable d (member date) of the C class in the A